home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / CSMP Digest / volume 3 / csmp-digest-v3-102 < prev    next >
Text File  |  1995-12-31  |  110KB  |  2,829 lines

  1. C.S.M.P. Digest             Sat, 01 Jul 95       Volume 3 : Issue 102
  2.  
  3. Today's Topics:
  4.  
  5.         AE source --> address descriptor (?)
  6.         AESetData events to Finder
  7.         Are AppleEvents efficient?
  8.         COMP.LANG.PASCAL.MAC - New Macintosh Pascal language newsgroup
  9.         Changing current printer without user intervention
  10.         Error checking calls to NewRgn & GetClip
  11.         GWorlds-CopyBits
  12.         Getting the selected portion of an editText item
  13.         Licensing the PEF format: the answer
  14.         MacTCP and Native code
  15.         MacTech vs. develop
  16.         MacsBug Docs? (was Re: Where are the @$# keyUp events?!!)
  17.         Overwhelmed newbie needs encouragement
  18.         Time manager callback without asm?
  19.         TransSkel 3.21 is available (MW Pascal support added)
  20.         Uppercase Command Keys?
  21.         [Q] Drag and Drop Mgr hilighting
  22.         [Q] How to tell if a hard disk is removable
  23.  
  24.  
  25.  
  26. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  27. (pottier@clipper.ens.fr).
  28.  
  29. The digest is a collection of article threads from the internet newsgroups
  30. comp.sys.mac.programmer.help, csmp.tools and csmp.misc. It is designed for
  31. people who read news semi-regularly and want an archive of the discussions.
  32. If you don't know what a newsgroup is, you probably don't have access to
  33. it. Ask your systems administrator(s) for details. If you don't have access
  34. to news, you may still be able to post messages to the group by using a
  35. mail server like anon.penet.fi (mail help@anon.penet.fi for more
  36. information).
  37.  
  38. Each issue of the digest contains one or more sets of articles (called
  39. threads), with each set corresponding to a 'discussion' of a particular
  40. subject.  The articles are not edited; all articles included in this digest
  41. are in their original posted form (as received by our news server at
  42. nef.ens.fr).  Article threads are not added to the digest until the last
  43. article added to the thread is at least two weeks old (this is to ensure that
  44. the thread is dead before adding it to the digest).  Article threads that
  45. consist of only one message are generally not included in the digest.
  46.  
  47. The digest is officially distributed by two means, by email and ftp.
  48.  
  49. If you want to receive the digest by mail, send email to listserv@ens.fr
  50. with no subject and one of the following commands as body:
  51.     help                                Sends you a summary of commands
  52.     subscribe csmp-digest Your Name     Adds you to the mailing list
  53.     signoff csmp-digest                 Removes you from the list
  54. Once you have subscribed, you will automatically receive each new
  55. issue as it is created.
  56.  
  57. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  58. Questions related to the ftp site should be directed to
  59. scott.silver@dartmouth.edu.
  60.  
  61. -------------------------------------------------------
  62.  
  63. >From kofoid@biology.utah.edu (Eric Kofoid)
  64. Subject: AE source --> address descriptor (?)
  65. Date: Thu, 01 Jun 1995 11:16:02 -0700
  66. Organization: Dept. Biology, University of Utah
  67.  
  68. My program receives an AppleEvent from another application, and extracts
  69. its keyEventSourceAttr attribute. How can it convert this into an address
  70. descriptor record to communicate efficiently with the original sender?
  71. ...or is there a better way to find the return address?
  72.  
  73. Cheers,
  74.  
  75. Eric.
  76. ==========
  77. Dept.Biology, U.of Utah
  78.  
  79. +++++++++++++++++++++++++++
  80.  
  81. >From BrianS@pbcomputing.com (Brian Stern)
  82. Date: 8 Jun 1995 03:39:57 GMT
  83. Organization: The University of Texas at Austin, Austin, Texas
  84.  
  85. In article <kofoid-0106951116020001@ls-42.biology.utah.edu>,
  86. kofoid@biology.utah.edu (Eric Kofoid) wrote:
  87.  
  88. < My program receives an AppleEvent from another application, and extracts
  89. < its keyEventSourceAttr attribute. How can it convert this into an address
  90. < descriptor record to communicate efficiently with the original sender?
  91. < ...or is there a better way to find the return address?
  92. < Cheers,
  93. < Eric.
  94. < ==========
  95. < Dept.Biology, U.of Utah
  96.  
  97. The return address is in the keyAddressAttr.  Here is some code that I use
  98. to build an AEDesc for a return address:
  99.  
  100. // ---------------------------------------------------------------------------
  101. //    
  102. // ---------------------------------------------------------------------------
  103. // Extract the sessionID from the appleevent.  There will either be a 
  104. // sessionID or a TargetID that has a sessionID inside it.
  105.  
  106. void
  107. GetSessionID( const AppleEvent &inAppleEvent )
  108. {
  109.    TargetID    theTarget;
  110.    DescType    theType;
  111.    Size        theSize;
  112.    
  113.    OSErr err = ::AEGetAttributePtr( &inAppleEvent, keyAddressAttr,
  114.                typeTargetID, &theType, &theTarget, sizeof(TargetID), &theSize );
  115.  
  116.    if ( err == errAECoercionFail )
  117.    {
  118.       err = ::AEGetAttributePtr( &inAppleEvent, keyAddressAttr,
  119.             typeSessionID, &theType, &theTarget.sessionID,
  120. sizeof(PPCSessRefNum),
  121.              &theSize );
  122.    }
  123.  
  124.    ThrowIfOSErr_(err);
  125.    
  126.    err = ::AECreateDesc( typeSessionID, &theTarget.sessionID,
  127. sizeof(PPCSessRefNum), 
  128.             &mClientDesc );
  129.    ThrowIfOSErr_(err);
  130.  
  131.    mClientSessionID = theTarget.sessionID;   // Save the sessionID
  132.  
  133. }
  134.  
  135. ____________________________________________________________________
  136. Brian  Stern  {:-{)}                          BrianS@pbcomputing.com
  137. Toolbox commando and Menu bard.             Will FlushCache for Cash
  138.  
  139. +++++++++++++++++++++++++++
  140.  
  141. >From grobbins@znet.com (Grobbins)
  142. Date: Thu, 08 Jun 1995 10:20:40 -0700
  143. Organization: Skunkworks
  144.  
  145. In article <kofoid-0106951116020001@ls-42.biology.utah.edu>,
  146. kofoid@biology.utah.edu (Eric Kofoid) wrote:
  147. >My program receives an AppleEvent from another application, and extracts
  148. >its keyEventSourceAttr attribute. How can it convert this into an address
  149. >descriptor record to communicate efficiently with the original sender?
  150. >...or is there a better way to find the return address?
  151.  
  152. A quick search through the tech notes reveals this old bit from note IC
  153. 505 - Apple Event Manager Q&As:
  154.  
  155.  
  156. - -
  157. Finding Apple event sender9s target ID or process serial number
  158. Date Written:  10/25/91
  159. Last reviewed:  6/14/93
  160. How can I identify the sender of an Apple event?
  161. ___
  162. If your application is just sending a reply, it should not be creating an
  163. Apple event or calling AESend. Instead, the Apple event handler should
  164. stuff the response information into the reply event, as shown on page 6-50
  165. of Inside Macintosh Volume VI. The Apple Event Manager takes care of
  166. addressing and sending the event.
  167.  
  168. To find the target ID or process serial number of the sender of an Apple
  169. event, use AEGetAttributePtr to extract the address attribute, as follows:
  170.  
  171. retCode := AEGetAttributePtr(myAppleEvent, keyAddressAttr,
  172.                 typeWildCard, senderType, @senderBuffer,
  173.                 sizeof(senderBuffer), senderSize)
  174.  
  175. The senderBuffer can later be used with AECreateDesc to create an address
  176. to be passed to AESend. The buffer should be at least as large as data
  177. type TargetID. See Inside Macintosh Volume VI, page 5-22, for a
  178. description of TargetID.
  179. - -
  180.  
  181.  
  182. Since the attribute is unknown size, it's probably easier to extract it
  183. with AEGetAttributeDesc.
  184.  
  185. Grobbins                                   grobbins@znet.com
  186.  
  187. +++++++++++++++++++++++++++
  188.  
  189. >From lai@apple.com (Ed Lai)
  190. Date: Sat, 17 Jun 1995 01:21:40 GMT
  191. Organization: Apple
  192.  
  193. In article <kofoid-0106951116020001@ls-42.biology.utah.edu>,
  194. kofoid@biology.utah.edu (Eric Kofoid) wrote:
  195.  
  196. > My program receives an AppleEvent from another application, and extracts
  197. > its keyEventSourceAttr attribute. How can it convert this into an address
  198. > descriptor record to communicate efficiently with the original sender?
  199. > ...or is there a better way to find the return address?
  200. > Cheers,
  201. > Eric.
  202. > ==========
  203. > Dept.Biology, U.of Utah
  204.  
  205. Event source means whether it is from same process, same machine or
  206. remote machine.
  207.  
  208. To find where it comes from, use the 'addr' attribute.
  209.  
  210. -- 
  211. /* Disclaimer: All statments and opinions expressed are my own */
  212. /* Edmund K. Lai                                               */
  213. /* Apple Computer, MS303-3A                                    */
  214. /* 20525 Mariani Ave,                                          */
  215. /* Cupertino, CA 95014                                         */
  216. /* (408)974-6272                                               */
  217. zW@h9cOi
  218.  
  219. ---------------------------
  220.  
  221. >From Carl R. Osterwald <carl_osterwald@nrel.gov>
  222. Subject: AESetData events to Finder
  223. Date: 9 Jun 1995 21:53:37 GMT
  224. Organization: National Renewable Energy Laboratory
  225.  
  226. Given a file as an FSSpec, I need to build object specifier record that
  227. points to the file's icon bitmap, in order to give the file a custom
  228. icon with a Set Data event to the scriptable Finder.  I have been
  229. following the code in the develop 20 article that describes the
  230. scriptable Finder, but the example give there just sends an empty
  231. bitmap list to the object currently selected, rather than to an FSSpec.
  232. How should I create the object specifier for the keyDirectObject portion
  233. of the event in this case?
  234.  
  235. I have tried using the special key form mentioned in the article,
  236. formAlias, but this did not work:
  237. - -----------------------------
  238.    error = AECreateDesc(typeNull, nil, 0, &null_descriptor);
  239.  
  240.    error = NewAliasMinimal(&file_spec, &file_alias);
  241.   
  242.    HLock( (Handle)file_alias );
  243.    
  244.    error = AECreateDesc( typeAlias, *file_alias,
  245.              GetHandleSize( (Handle)file_alias ),
  246.              &alias_descriptor);
  247.  
  248.    DisposeHandle( (Handle)file_alias );
  249.  
  250.    error = CreateObjSpecifier( typeWildCard, &null_descriptor,
  251.              formAlias, &alias_descriptor,
  252.              true, &file_specifier);
  253.   
  254.    DescType property = pIconBitmap;
  255.    
  256.    error = AECreateDesc( typeType, (Ptr)&property,
  257.              sizeof(DescType),
  258.              &icon_property);
  259.  
  260.    error = CreateObjSpecifier( cProperty, &file_specifier,
  261.              formPropertyID, &icon_property,
  262.              true, &icon_specifier);
  263.   
  264.    error = AEPutParamDesc( &event,
  265.              keyDirectObject,
  266.              &icon_specifier);
  267.    
  268.    AEDisposeDesc(&icon_specifier);
  269.                 
  270.  
  271.    error = AECreateList(nil, 0, make_AERecord, &icon_family);
  272.   
  273.  
  274.    error = AEPutKeyPtr( &icon_family, keyIconAndMask,
  275.              typeIconAndMask,
  276.              ICN_, GetPtrSize(ICN_) );
  277.  
  278.    error = AEPutKeyPtr( &icon_family, key8BitIcon,
  279.              type8BitIcon,
  280.              icl8, GetPtrSize(icl8) );
  281.  
  282.    error = AEPutKeyPtr( &icon_family, key4BitIcon,
  283.              type4BitIcon,
  284.              icl4, GetPtrSize(icl4) );
  285.  
  286.    error = AEPutKeyPtr( &icon_family, keySmallIconAndMask,
  287.              typeSmallIconAndMask,
  288.              ics_, GetPtrSize(ics_) );
  289.  
  290.    error = AEPutKeyPtr( &icon_family, keySmall8BitIcon,
  291.              typeSmall8BitIcon,
  292.              ics8, GetPtrSize(ics8) );
  293.  
  294.    error = AEPutKeyPtr( &icon_family, keySmall4BitIcon,
  295.              typeSmall4BitIcon,
  296.              ics4, GetPtrSize(ics4) );
  297.   
  298.    error = AEPutParamDesc(&event, keyAEData, &icon_family);
  299.  
  300.    AEDisposeDesc(&icon_family);
  301.   
  302.    error = AESend( &event, &reply, kAEWaitReply,
  303.              kAEHighPriority,  kAEDefaultTimeout,
  304.              (AEIdleUPP)AE_idle_function, nil);
  305.  
  306. result: -10001 errAETypeError
  307. - -----------------------------
  308.  
  309. I have sucessfully sent update events to the Finder, so I know
  310. the rest of the code for addressing the events is working.
  311.  
  312. +++++++++++++++++++++++++++
  313.  
  314. >From jwbaxter@olympus.net (John W. Baxter)
  315. Date: Sat, 10 Jun 1995 15:13:30 -0700
  316. Organization: Internet for the Olympic Peninsula
  317.  
  318. In article <3raft1$j0t@nrel.nrel.gov>, Carl R. Osterwald
  319. <carl_osterwald@nrel.gov> wrote:
  320.  
  321. > Given a file as an FSSpec, I need to build object specifier record that
  322. > points to the file's icon bitmap, in order to give the file a custom
  323. > icon with a Set Data event to the scriptable Finder.  I have been
  324. > following the code in the develop 20 article that describes the
  325. > scriptable Finder, but the example give there just sends an empty
  326. > bitmap list to the object currently selected, rather than to an FSSpec.
  327. > How should I create the object specifier for the keyDirectObject portion
  328. > of the event in this case?
  329.  
  330. Just use AEPutParamPtr() to make the keyDirectObject parameter a copy of
  331. the FSSpec struct, using type typeFSS.  Scriptable Finder will accept a
  332. typeAlias or typeFSS in places where it pretends it wants one of its
  333. object specifiers specifying a file.
  334.  
  335.   --John (yes, I didn't read the rest of the function in detail)
  336.  
  337. -- 
  338. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  339.        I don't do windows.
  340.    jwbaxter@pt.olympus.net
  341.  
  342. +++++++++++++++++++++++++++
  343.  
  344. >From grobbins@znet.com (Grobbins)
  345. Date: Sun, 11 Jun 1995 02:39:21 -0700
  346. Organization: Skunkworks
  347.  
  348. In article <3raft1$j0t@nrel.nrel.gov>, Carl R. Osterwald
  349. <carl_osterwald@nrel.gov> wrote:
  350. >Given a file as an FSSpec, I need to build object specifier record that
  351. >points to the file's icon bitmap, in order to give the file a custom
  352. >icon with a Set Data event to the scriptable Finder.  I have been
  353. >following the code in the develop 20 article that describes the
  354. >scriptable Finder, but the example give there just sends an empty
  355. >bitmap list to the object currently selected, rather than to an FSSpec.
  356.  
  357. The posted direct object code looks pretty good; best way to test it is to
  358. do a GetData instead of a SetData. 
  359.  
  360. Unfortunately, the Finder is a little weird about icon bitmaps.  It'll
  361. take an empty list to clear an icon, but what it wants as keyAEData to set
  362. an icon is the icon data in an AERecord that has been manually coerced to
  363. a typeIconFamily ('ifam').  The keywords and typecodes for the parameters
  364. of the AERecord should both be the icon resource types (like 'ics8').
  365.  
  366.  
  367. Grobbins                         grobbins@znet.com
  368.  
  369. +++++++++++++++++++++++++++
  370.  
  371. >From Carl R. Osterwald <carl_osterwald@nrel.gov>
  372. Date: 12 Jun 1995 16:44:09 GMT
  373. Organization: National Renewable Energy Laboratory
  374.  
  375. In article <jwbaxter-1006951513300001@ptpm019.olympus.net> John W.
  376. Baxter, jwbaxter@olympus.net writes:
  377. >Just use AEPutParamPtr() to make the keyDirectObject parameter a copy of
  378. >the FSSpec struct, using type typeFSS.  Scriptable Finder will accept a
  379. >typeAlias or typeFSS in places where it pretends it wants one of its
  380. >object specifiers specifying a file.
  381.  
  382. Yes, this is true.  For the Update event, all you need is an FSSpec in
  383. the keyDirectObject.  However, for the Set Data event, the
  384. keyDirectObject needs to indicate the object being set, e.g. the icon
  385. bitmap.  So I think an object specifier is required in this case.
  386.  
  387. In article <grobbins-1106950239210001@user13.znet.com> Grobbins,
  388. grobbins@znet.com writes:
  389. >The posted direct object code looks pretty good; best way to test it is to
  390. >do a GetData instead of a SetData. 
  391.  
  392. Thanks, I'll poke around with the Get Data event.
  393.  
  394. >Unfortunately, the Finder is a little weird about icon bitmaps.  It'll
  395. >take an empty list to clear an icon, but what it wants as keyAEData to set
  396. >an icon is the icon data in an AERecord that has been manually coerced to
  397. >a typeIconFamily ('ifam').
  398.  
  399. I didn't do a manual coercion of the AERecord to typeIconFamily, I'll
  400. try it out.
  401.  
  402. >The keywords and typecodes for the parameters
  403. >of the AERecord should both be the icon resource types (like 'ics8').
  404.  
  405. I included <FinderRegistry.h> from the develop 20 article which makes
  406. these definitions.
  407.  
  408. ---------------------------
  409.  
  410. >From Jamie Uther <jimu@cs.su.oz.au>
  411. Subject: Are AppleEvents efficient?
  412. Date: 13 Jun 1995 11:51:05 GMT
  413. Organization: The Greenhouse, Dept. of Comp. Sci, Sydney University
  414.  
  415. Just how slow and resource-hungry are appleEvents? If i were to
  416. write an application as a bunch of modules communicating 
  417. via appleEvents (like openDoc?) would i be getting into
  418. trouble? I assume they're slower than shared memory,
  419. but are they slower than RPC? How much slower? How do
  420. they fit in with SOM and other message passing schemes?
  421.  
  422. this enquiring mind wants to know! so does anyone have
  423. any hard knowledge about this?
  424.  
  425. thanks
  426.         jim
  427.         jimu@cs.usyd.edu.au
  428.  
  429.  
  430. +++++++++++++++++++++++++++
  431.  
  432. >From jwbaxter@olympus.net (John W. Baxter)
  433. Date: Tue, 13 Jun 1995 10:05:54 -0700
  434. Organization: Internet for the Olympic Peninsula
  435.  
  436. In article <3rju39$i3j@staff.cs.su.oz.au>, Jamie Uther <jimu@cs.su.oz.au> wrote:
  437.  
  438. > Just how slow and resource-hungry are appleEvents? If i were to
  439. > write an application as a bunch of modules communicating 
  440. > via appleEvents (like openDoc?) would i be getting into
  441. > trouble? I assume they're slower than shared memory,
  442. > but are they slower than RPC? How much slower? How do
  443. > they fit in with SOM and other message passing schemes?
  444.  
  445. If the Apple event passes from process (in the Process Manager sense) to
  446. process, it is "fairly slow" (the system seems to manage about 30 per
  447. second on reasonable hardware).  If it is sent on a queued basis within a
  448. process, it is less slow.  If the event is a "send-to-self" event (address
  449. is specifically a PSN of kCurrentProcess), it is essentially a somewhat
  450. slow function call (that is, very much faster than the other cases).  The
  451. send-to-self case is "fast enough" to be used for things like responding
  452. to UI actions without appearing slower to the user than direct funtion
  453. calls used to be.
  454.  
  455. Sorry...nothing quantitative.
  456.  
  457. You can also produce a fairly fast interprocess event:  send it by
  458. send-to-self, but self doesn't handle it.  The target has installed a
  459. System event handler for the event, and handles it.  The target code has
  460. to be quite careful:  it is running as an intruder in the caller's space. 
  461. No screen updating, and various other things.  One form of Frontier
  462. menusharing uses this, as does UserLand's little "uBASE" database.  These
  463. sends are "very much faster" than normal interprocess sends.  They are
  464. also tricky to code the handlers for, and tricky to debug.
  465.  
  466.     --John
  467.  
  468. -- 
  469. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  470.        I don't do windows.
  471.    jwbaxter@pt.olympus.net
  472.  
  473. +++++++++++++++++++++++++++
  474.  
  475. >From isis@netcom.com (Mike Cohen)
  476. Date: Tue, 13 Jun 1995 20:37:25 GMT
  477. Organization: ISIS International
  478.  
  479. jwbaxter@olympus.net (John W. Baxter) writes:
  480.  
  481. >If the Apple event passes from process (in the Process Manager sense) to
  482. >process, it is "fairly slow" (the system seems to manage about 30 per
  483. >second on reasonable hardware).  If it is sent on a queued basis within a
  484. >process, it is less slow.  If the event is a "send-to-self" event (address
  485. >is specifically a PSN of kCurrentProcess), it is essentially a somewhat
  486. >slow function call (that is, very much faster than the other cases).  The
  487. >send-to-self case is "fast enough" to be used for things like responding
  488. >to UI actions without appearing slower to the user than direct funtion
  489. >calls used to be.
  490.  
  491. According to Apple at WWDC, AppleEvent performace will be much faster in
  492. Copland & AppleEvents still remain the preferred IPC method.
  493. -- 
  494. Mike Cohen - isis@netcom.com
  495. Home Page: ftp://ftp.netcom.com/pub/is/isis/home.html
  496. PUSH THE BUTTON... SOMEONE
  497.  
  498. +++++++++++++++++++++++++++
  499.  
  500. >From awiner@us.oracle.com (Adam Winer)
  501. Date: Tue, 13 Jun 1995 17:30:46 -0800
  502. Organization: Oracle Corp.
  503.  
  504. In article <3rju39$i3j@staff.cs.su.oz.au>, Jamie Uther <jimu@cs.su.oz.au> wrote:
  505.  
  506. >Just how slow and resource-hungry are appleEvents? If i were to
  507. >write an application as a bunch of modules communicating 
  508. >via appleEvents (like openDoc?) would i be getting into
  509. >trouble? I assume they're slower than shared memory,
  510. >but are they slower than RPC? How much slower? How do
  511. >they fit in with SOM and other message passing schemes?
  512. >
  513. >this enquiring mind wants to know! so does anyone have
  514. >any hard knowledge about this?
  515.  
  516. Simple answer: now, kinda slow and inefficient.  In
  517. Copland, stinkin' fast.  The current Copland benchmark
  518. is something like 150,000 Apple Events a second.
  519. -- 
  520. Adam Winer
  521. awiner@us.oracle.com
  522.  
  523. ---------------------------
  524.  
  525. >From sam@ccnet.com (Scott A. Moore)
  526. Subject: COMP.LANG.PASCAL.MAC - New Macintosh Pascal language newsgroup
  527. Date: 13 Jun 1995 17:10:06 -0500
  528. Organization: CCnet Communications (510-988-7140 guest)
  529.  
  530. A new newsgroup has been created exclusively for Pascals on the Macintosh,
  531. including Apple Pascal, Think Pascal, CodeWarrior and others. This will
  532. finally give Mac Pascal programmers a place to discuss Pascal implementation
  533. on the Macintosh without being mixed in with other Pascals or the C language.
  534. The new group was named:
  535.  
  536.      comp.lang.pascal.mac
  537.  
  538. and was created today, June 12, 1994 (if the group has not been created on
  539. your news-host, you may want to contact your news-admin and request the group)
  540.  
  541.                                            [sam]
  542.  
  543.  
  544.  
  545. ---------------------------
  546.  
  547. >From ird@netspace.net.au (Ian Dobson)
  548. Subject: Changing current printer without user intervention
  549. Date: Tue, 06 Jun 1995 20:53:25 +1000
  550. Organization: NetSpace Online Systems
  551.  
  552. My company has recently purchased a dedicated label printer for printing
  553. mailing labels. We are running a moderately complicated programmable
  554. database system to store client records and maintain accounts.
  555.  
  556. Currently it is a pain in the ass for users to print labels, because they
  557. have to go to Chooser, select the label printer, print the label, go back
  558. to Chooser and select the LaserWriter (for normal output) again.
  559.  
  560. Now, please don't flame me for heresy, but is there any way to program
  561. around this process so that the users can just choose a command "print a
  562. label" from our database system (OMNIS, but can be customized with C
  563. extensions etc.) and it will go the right way?
  564.  
  565. It's been a long time since I delved into this type of problem but last
  566. time I looked this was the sort of thing that Apple thought police locked
  567. you up for asking. Why, I ask? The ability to select a printer
  568. automatically here would improve the user interface from our perspective
  569. and save us a lot of time.
  570.  
  571. If there are no ways of doing this safely by circumventing the Chooser,
  572. can the Chooser be controlled with Apple Events / AppleScript and if so
  573. then how?
  574.  
  575. Please direct any response to e-mail (ird@netspace.net.au) because I don't
  576. read this group very often and our newsserver is kind of flaky about
  577. getting all the return mail at the moment.
  578.  
  579. TIA
  580.  
  581. -- 
  582. Ian R. Dobson
  583. ird@netspace.net.au
  584.  
  585. +++++++++++++++++++++++++++
  586.  
  587. >From pandhphot@aol.com (PandH Phot)
  588. Date: 6 Jun 1995 17:53:43 -0400
  589. Organization: America Online, Inc. (1-800-827-6364)
  590.  
  591. I have a routine I've used for some time which RETURNS the name of the
  592. currently-selected printer. I suppose a daring person could try to modify
  593. it to SET the name, as well. Here's how it works:
  594.  
  595. 1) Get the name of the currently-selected printer driver by calling
  596. GetString on resource ID -8192. This string resource resides in the System
  597. and tracks, well, the current printer driver. I should warn you that Apple
  598. has specifically told me that this is undocumented and not guaranteed to
  599. be forever cool.
  600.  
  601. 2) Get a dirID to the current Extensions folder using FindFolder and the
  602. following contants: kOnSystemDisk,  kExtensionFolderType,
  603. kDontCreateFolder.
  604.  
  605. 3) Using the file name (same as driver name) from step 1 and the dirID
  606. from step 2, open the printer driver using FSpOpenResFile.
  607.  
  608. 4) Get resource type 'PAPA', ID -8192, from the newly-opened resource
  609. file. The first pascal string in the PAPA resource appears to always
  610. contain the currently-selected printer's name.
  611.  
  612. Hope this helps
  613.  
  614. Paul
  615.  
  616. +++++++++++++++++++++++++++
  617.  
  618. >From dowdy@apple.com (Tom Dowdy)
  619. Date: Wed, 7 Jun 1995 15:28:03 GMT
  620. Organization: Apple Computer, Inc.
  621.  
  622. In article <3r2ip7$ce1@newsbf02.news.aol.com>, pandhphot@aol.com (PandH
  623. Phot) wrote:
  624.  
  625. > I have a routine I've used for some time which RETURNS the name of the
  626. > currently-selected printer. I suppose a daring person could try to modify
  627. > it to SET the name, as well. Here's how it works:
  628. > 1) Get the name of the currently-selected printer driver by calling
  629. > GetString on resource ID -8192. This string resource resides in the System
  630. > and tracks, well, the current printer driver. I should warn you that Apple
  631. > has specifically told me that this is undocumented and not guaranteed to
  632. > be forever cool.
  633.  
  634. And specifically, that forever is now.  On machines running QuickDraw
  635. GX, both the string for the current printer, and the information
  636. you "document" below for changing the "current printer string"
  637. do not work.
  638.  
  639. Applications which use GX can change the printer that is assigned
  640. to a particular document they have open via a publically documented
  641. and supported API.
  642.  
  643. -- 
  644.  Tom Dowdy                  Internet: dowdy@apple.COM
  645.  Apple Computer MS:302-3KS  UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
  646.  1 Infinite Loop            AppleLink: DOWDY1
  647.  Cupertino, CA 95014       
  648.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  649.  
  650. +++++++++++++++++++++++++++
  651.  
  652. >From ldo@waikato.ac.nz (Lawrence D9Oliveiro)
  653. Date: Thu, 08 Jun 1995 17:35:04 +1200
  654. Organization: University of Waikato
  655.  
  656. In article <3r2ip7$ce1@newsbf02.news.aol.com>, pandhphot@aol.com (PandH
  657. Phot) wrote:
  658.  
  659. >1) Get the name of the currently-selected printer driver by calling
  660. >GetString on resource ID -8192. This string resource resides in the System
  661. >and tracks, well, the current printer driver. I should warn you that Apple
  662. >has specifically told me that this is undocumented and not guaranteed to
  663. >be forever cool.
  664.  
  665. It breaks with people using QuickDraw GX (as I am); under GX, this string
  666. holds the name of the default desktop printer.
  667.  
  668. ---------------------------
  669.  
  670. >From Squeegee@cris.com (Squeegee)
  671. Subject: Error checking calls to NewRgn & GetClip
  672. Date: Wed, 07 Jun 1995 14:59:59 -0400
  673. Organization: SQ Software
  674.  
  675. [ Note:  In composing my message, I answered my own question.  I figured
  676.   I'd post it anyway so I can be corrected if I'm wrong, and because
  677.   maybe someone will benefit from reading it.  The answer is that it's
  678.   probably best not to error check these functions (there's really no
  679.   great way to do it anyway) and have a GrowZoneProc which manages a
  680.   small amount of reserve memory to guarantee that these functions don't
  681.   fail due to lack of memory.  See TCL or MacApp or PowerPlant for
  682.   examples of GrowZoneProc management. ]
  683.  
  684. Safe code experts,
  685.  
  686. I was reviewing some code I had written and came across some code
  687. similar to this example from Think Reference:
  688.  
  689.         saveClipRgn = NewRgn();         /* get an empty region */
  690.         GetClip( saveClipRgn );         /* save current */
  691.         SetClip( myClipRgn );           /* install desired clipRgn */
  692.  
  693.         /*... ( draw a figure )  ... */
  694.  
  695.         SetClip( saveClipRgn );         /* restore previous value */
  696.         DisposeRgn( saveClipRgn );      /* not needed any more */
  697.  
  698. Note that there is no error checking on either the call to "NewRgn" or
  699. the call to "GetClip".  It struck me that if I wanted to be completely
  700. safe, I should check for errors after each of those calls.
  701.  
  702. I pulled out the NIM volume "Imaging with Quickdraw" to check what the
  703. most modern advice from Apple is on these calls.  The description of
  704. "NewRgn" doesn't mention that the call might fail and what would happen
  705. in that case.  For example, it doesn't explicitly state that NewRgn
  706. would return NULL if the allocation failed, though I assume it would.
  707.  
  708. In the description of "GetClip", they don't say what happens if the call
  709. fails.  They do mention that you could check if the call might succeed
  710. before you make it by calling MaxMem.
  711.  
  712. I remember reading that the Toolbox itself would crash if there wasn't a
  713. small amount of memory (like 2K) available in the heap so that calls
  714. like this are guaranteed to succeed.  Is that the prevailing opinion
  715. regarding calls such as this.  Should we simply assume that they always
  716. succeed because allocating a 10 byte handle and copying what is usually
  717. a small tens of bytes or less clipRgn are will within this minimum
  718. memory cushion?
  719.  
  720. Would you recommend writing code like this (using TCL-style exceptions):
  721.  
  722.         Size growBytes;
  723.  
  724.         saveClipRgn = NewRgn();         /* get an empty region */
  725.  
  726.         FailNIL(saveClipRgn);
  727.  
  728.         if (qd.thePort->clipRgn.rgnSize < MaxMem(&growBytes)) {
  729.  
  730.                 GetClip( saveClipRgn ); /* save current */
  731.  
  732.                 SetClip( myClipRgn );   /* install desired clipRgn */
  733.  
  734.                 /*... ( draw a figure )  ... */
  735.  
  736.                 SetClip( saveClipRgn ); /* restore previous value */
  737.                 DisposeRgn( saveClipRgn ); /* not needed any more */
  738.  
  739.         }
  740.  
  741. Would that be completely safe?  Would it be reasonable or overkill?
  742. The call to MaxMem seems particularly silly.
  743.  
  744. What's the latest thinking?  Should we assume NewRgn and GetClip
  745. never fail?  Is this why we should always have a GrowZoneProc that
  746. can alway come up with a little more memory for such cases?
  747.  
  748. Thanks,
  749.  
  750. --Steve
  751.  
  752. --
  753. Stephen C. Gilardi
  754. SQ Software
  755. squeegee@cris.com
  756.  
  757. +++++++++++++++++++++++++++
  758.  
  759. >From grobbins@znet.com (Grobbins)
  760. Date: Thu, 08 Jun 1995 10:42:14 -0700
  761. Organization: Skunkworks
  762.  
  763. In article <3r4t25$h8j@warp.cris.com>, Squeegee@cris.com (Squeegee) wrote:
  764. >[ Note:  In composing my message, I answered my own question.  I figured
  765. >  I'd post it anyway so I can be corrected if I'm wrong, and because
  766. >  maybe someone will benefit from reading it.  The answer is that it's
  767. >  probably best not to error check these functions (there's really no
  768. >  great way to do it anyway) and have a GrowZoneProc which manages a
  769. >  small amount of reserve memory to guarantee that these functions don't
  770. >  fail due to lack of memory.
  771.  
  772. It's true that most apps won't bother error-checking tiny allocations such
  773. as a new region allocation.  The primary advantage of checking the success
  774. of those calls would be to find out if the system is already hosed.  For
  775. example, if h = NewHandle(10) were to fail, odds are not that memory is
  776. tight, but rather that something is corrupted in the heap.  For this
  777. reason, asserting during development that a tiny allocation succeeded is
  778. useful [for example,   #if DEBUG     if (h == nil) DebugStr("\p newhandle
  779. failed, something is really wrong");     #endif ]
  780.  
  781. GrowZone procs are really rather archaic, though.  They were appropriate
  782. for a day when heaps were not automatically grown at launch with
  783. MaxApplZone, in order to avoid limiting stack space, and when apps really
  784. did have to worry about running down to their last few bytes.  But there
  785. is little a growZone proc can do safely, since it is called from within
  786. Memory Manager operations and thus is subject to toolbox reentrancy
  787. problems.
  788.  
  789. A reasonable strategy these days is to simply make certain that an app has
  790. a maximized heap and an adequate buffer of free space available.  For
  791. medium-to-large applications, checking that there is always something like
  792. 30K or even twice that available is not unreasonable.  When memory becomes
  793. tight, then, the app detects it long before the toolbox is likely to have
  794. a problem, and the app can take whatever steps it deems appropriate --
  795. freeing up reserve blocks, writing data to disk, or warning the user and
  796. disabling features, for example.  Your level of paranoia may drive you to
  797. install a growZone proc as well, but something is wrong if that's the
  798. first place a low-memory situation is detected.
  799.  
  800. Grobbins                           grobbins@znet.com
  801.  
  802. ---------------------------
  803.  
  804. >From Daniel_B._Bogan@khazad.apana.org.au (Daniel B. Bogan)
  805. Subject: GWorlds-CopyBits
  806. Date: 15 Jun 1995 19:40:45 GMT
  807. Organization: Khazad-dum BBS
  808.  
  809. I'm having great difficulty in getting GWorlds and CopyBits to work in THINK C
  810. 6.0.
  811. I'm in desperate need of assistance! <stress>
  812.  
  813. Basically, I can't get either to work how i'd like them to I want to be able
  814. to do animation with CopyBits, etc. etc. So far, no luck.
  815.  
  816. Does anyone have any text files/code/suggestions? 
  817.  
  818. Much appreciated.
  819.  
  820. (I'm not *sure*, but is it possible that in my version is fairly different to
  821. 5?
  822.  Because i've looked at code from 5.0, and it let's you SetPort to a GWorld,
  823. but mine doesn't...<ponder>)
  824.  
  825. Thanks,
  826.     DB
  827.  
  828. +++++++++++++++++++++++++++
  829.  
  830. >From scottlf@cris.com (Scott L. Foglesong)
  831. Date: 16 Jun 1995 08:04:15 GMT
  832. Organization: CRIS
  833.  
  834. In article <3327131646.59313@khazad.apana.org.au>, 
  835. Daniel_B._Bogan@khazad.apana.org.au says...
  836. >
  837. >I'm having great difficulty in getting GWorlds and CopyBits to 
  838. work in THINK C
  839. >6.0.
  840. >I'm in desperate need of assistance! <stress>
  841. >
  842. >Basically, I can't get either to work how i'd like them to I 
  843. want to be able
  844. >to do animation with CopyBits, etc. etc. So far, no luck.
  845. >
  846. >Does anyone have any text files/code/suggestions? 
  847. >
  848. >Much appreciated.
  849. >
  850. >(I'm not *sure*, but is it possible that in my version is 
  851. fairly different to
  852. >5?
  853. > Because i've looked at code from 5.0, and it let's you SetPort 
  854. to a GWorld,
  855. >but mine doesn't...<ponder>)
  856.  
  857. One of the big changes in post-5.0 versions of THINK C is that 
  858. they are considerably fussier about type checking. Although you 
  859. can turn some of that off in the compiler options settings, it's 
  860. really a pretty good idea to keep them fussy since it helps you 
  861. to avoid sometimes minor but hard-to-find bugs.
  862.  
  863. I'm not sure if this is your problem or not, but just try adding 
  864. a cast for the type you want with SetPort() and see if that 
  865. works. SetPort is normally defined is taking a GrafPtr--so that 
  866. may be all you need.
  867.  
  868. When I moved from THINK C 5 to 7, I spent quite a bit of time 
  869. going back over things that worked previously and having to 
  870. work out more casts. Kind of annoying but I suppose in the long 
  871. run it's all for the best.
  872.  
  873. -- 
  874. - ---------------------------
  875. Scott L. Foglesong
  876. San Francisco Conservatory of Music
  877. scottlf@cris.com // scottlf@aol.com
  878. "Too many notes, my dear fellow, too many notes."
  879. - ---------------------------
  880.  
  881.  
  882. +++++++++++++++++++++++++++
  883.  
  884. >From Steve Sauder <nplains@passport.ca>
  885. Date: 16 Jun 1995 13:18:04 GMT
  886. Organization: North Plains Systems Inc.
  887.  
  888. scottlf@cris.com (Scott L. Foglesong) wrote:
  889. >> Because i've looked at code from 5.0, and it let's you SetPort 
  890. >to a GWorld,
  891. >>but mine doesn't...<ponder>)
  892.  
  893. [snip]
  894.  
  895. >I'm not sure if this is your problem or not, but just try adding 
  896. >a cast for the type you want with SetPort() and see if that 
  897. >works. SetPort is normally defined is taking a GrafPtr--so that 
  898. >may be all you need.
  899.  
  900. SetPort is not safe to use with GWorlds.  You should be using
  901. SetGWorld(...) instead.  So, instead of doing this:
  902.  
  903. GrafPtr svPort;
  904. GetPort(&svPort);
  905. SetPort((GrafPtr) myGWorld);
  906. ..
  907. SetPort(svPort);
  908.  
  909. You should do this:
  910.  
  911. CGrafPtr svPort;
  912. GDHandle svDev;
  913. GetGWorld(&svPort, &svDev);
  914. SetGWorld(myGWorld, nil);
  915. ..
  916. SetGWorld(svPort, svDev);
  917.  
  918. This is because off-screen GWorlds may (and probably will) reside
  919. in a different *device*, and SetPort will not take this into
  920. account, causing possible system crashes and various other mean
  921. stuff when you attempt to work in your GWorld.
  922.  
  923. Regards,
  924. Steve. 
  925.  
  926. - ------------------------------------------------------------------
  927. Steve Sauder                                     nplains@passport.ca
  928. North Plains Systems Inc.
  929. Macintosh Software for Electronic Publishing
  930.  
  931.  
  932.  
  933. +++++++++++++++++++++++++++
  934.  
  935. >From am4001@kestrel.fen.bris.ac.uk (Alex Metcalf)
  936. Date: Fri, 16 Jun 1995 16:38:07 GMT
  937. Organization: The Twilight Zone
  938.  
  939. Daniel B. Bogan (Daniel_B._Bogan@khazad.apana.org.au) wrote:
  940. : I'm having great difficulty in getting GWorlds and CopyBits to work in
  941. : THINK C 6.0. I'm in desperate need of assistance! <stress>
  942.  
  943. : Basically, I can't get either to work how i'd like them to I want to be
  944. : able to do animation with CopyBits, etc. etc. So far, no luck.
  945.  
  946. : Does anyone have any text files/code/suggestions? 
  947.  
  948.         First you need to get hold of the right documentation on GWorlds.
  949. The best place (if you're low on cash) is good ol' Inside Mac 6. I'm sure
  950. there's a new Inside Mac book which covers offscreen worlds, but I haven't
  951. got the money to find out. :)
  952.  
  953.         Next, remember a couple of golden rules. One such rule is you must
  954. use LockPixels on a GWorld before doing anything with it. Another problem
  955. which catches people out is the CopyBits command: people often dereference
  956. or reference a variable too many times, and things go nuts. For GWorld to
  957. screen:
  958.  
  959. CopyBits ((BitMap *) *worldPixMap, (BitMap *) &screenWindow->portPixMap,
  960.    sourceRect, destRect, srcCopy, nil);
  961.  
  962.         I'm doing that from memory, but I think that's about right. A
  963. quick fudge to remember: use * for your GWorld and & for your screen window.
  964.  
  965. <snip>
  966.  
  967. : (I'm not *sure*, but is it possible that in my version is
  968. : fairly different to  5?
  969. : Because i've looked at code from 5.0, and it let's you SetPort to a GWorld,
  970. : but mine doesn't...<ponder>)
  971.  
  972.         You need to use GetGWorld and SetGWorld:
  973.  
  974. CGrafPtr  savedPort;
  975. GDHandle  savedDevice;
  976.  
  977. GetGWorld (&savedPort, &savedDevice);
  978. SetGWorld (myWorld, nil);
  979. ...
  980. // do drawing to world here
  981. ...
  982. SetGWorld (savedPort, savedDevice);
  983.  
  984.         At least, I _think_ they're called GetGWorld and SetGWorld. :)
  985.  
  986.         One final thing: if you're writing a game and you don't care much
  987. about memory, use LockPixels on your GWorld Pix Maps immediately after you
  988. create the GWorlds, and then leave it locked throughout the game. You need
  989. never use LockPixels again...
  990.  
  991.  
  992.  
  993.  
  994.         Alex :)
  995.  
  996. --
  997. Alex Metcalf             Windows 95: Just another
  998. am4001@bristol.ac.uk        pane in the glass.
  999.  
  1000. http://www.fen.bris.ac.uk/students/am4001/
  1001.  
  1002.  
  1003. ---------------------------
  1004.  
  1005. >From schmeul@umich.edu (Sam Huffman)
  1006. Subject: Getting the selected portion of an editText item
  1007. Date: 1 Jun 1995 15:41:43 GMT
  1008. Organization: University of Michigan
  1009.  
  1010. I hope someone can help me with this:
  1011.  
  1012. I have a dialog box with several editText items. After the user selects a
  1013. portion of the text in one particular editText item, I would like to
  1014. retrieve the _selected_ portion into a string. For example, if the
  1015. editText field contained "The Quick Brown Fox" and the user selected
  1016. "Quick Bro" then as soon as he releases the mouse button I want to
  1017. retrieve "Quick Bro" into a string.
  1018.  
  1019. I assume I will need to write an event filter to filter out mouseUp
  1020. events. However, after I have done this how can I determine which item the
  1021. user has clicked in? Furthermore, how can I determine what the selected
  1022. portion is? 
  1023.  
  1024. I appreciate any help anyone can give me.
  1025.  
  1026. Sam Huffman
  1027. schmeul@umich.edu
  1028.  
  1029. +++++++++++++++++++++++++++
  1030.  
  1031. >From Francois-Regis.Degott@imag.fr (F. Degott)
  1032. Date: 15 Jun 1995 11:48:33 GMT
  1033. Organization: LMC-IMAG Grenoble France
  1034.  
  1035. In article <schmeul-0106951139570001@162.48.124.18>, schmeul@umich.edu
  1036. (Sam Huffman) wrote:
  1037.  
  1038. >I hope someone can help me with this:
  1039. >
  1040. >I have a dialog box with several editText items. After the user selects a
  1041. >portion of the text in one particular editText item, I would like to
  1042. >retrieve the _selected_ portion into a string. For example, if the
  1043. >editText field contained "The Quick Brown Fox" and the user selected
  1044. >"Quick Bro" then as soon as he releases the mouse button I want to
  1045. >retrieve "Quick Bro" into a string.
  1046. >
  1047. >I assume I will need to write an event filter to filter out mouseUp
  1048. >events. However, after I have done this how can I determine which item the
  1049. >user has clicked in? Furthermore, how can I determine what the selected
  1050. >portion is? 
  1051. >
  1052. >I appreciate any help anyone can give me.
  1053. >
  1054.  
  1055. Hi Sam,
  1056.  
  1057. if you use a ModalDialog call,
  1058. it's not necessary to write a event filter for that job.
  1059. When the user works on an item of your dialog, ModalDialog 
  1060. returns the item id in the itemHit var.
  1061. In this case, you can detect clicks on edit text, and get the
  1062. TEHandle (corresponding to the edit text) in the textH field
  1063. of the DialogPeek record. So, you can access the selection
  1064. range of the active edit text with the selStart and selEnd
  1065. fields in textH^^.
  1066.  
  1067.  
  1068. repeat
  1069.       ModalDialog(nil,itemHit);
  1070.       if itemHit=MyEditTextID then 
  1071.       begin
  1072.             SelectionStart:=DialogPeek(MyDlog)^.textH^^.selStart;
  1073.             SelectionEnd:=DialogPeek(MyDlog)^.textH^^.selEnd;
  1074.       end;
  1075. until itemHit in [ok,cancel];
  1076.  
  1077.  
  1078. For more info, see the dialog manager (IM vol 1)
  1079.  
  1080. Hope this helps.
  1081. Fr
  1082. _____________________________________________________
  1083. F.R. Degott  (Francois-Regis.Degott@imag.fr)
  1084. LogiMath at Lab. LMC-IMAG - Univ. Joseph Fourier - Grenoble - France
  1085.  "Quand on n'a pas ce qu'on aime, on aime ce qu'on a." 
  1086.  
  1087. +++++++++++++++++++++++++++
  1088.  
  1089. >From larson@base.cs.ucla.edu (Christopher Larson)
  1090. Date: 15 Jun 1995 16:35:29 GMT
  1091. Organization: UCLA, Computer Science Department
  1092.  
  1093. In article <schmeul-0106951139570001@162.48.124.18> schmeul@umich.edu (Sam Huffman) writes:
  1094. >I have a dialog box with several editText items. After the user selects a
  1095. >portion of the text in one particular editText item, I would like to
  1096. >retrieve the _selected_ portion into a string. For example, if the
  1097. >editText field contained "The Quick Brown Fox" and the user selected
  1098. >"Quick Bro" then as soon as he releases the mouse button I want to
  1099. >retrieve "Quick Bro" into a string.
  1100. >
  1101. >I assume I will need to write an event filter to filter out mouseUp
  1102. >events. However, after I have done this how can I determine which item the
  1103. >user has clicked in? Furthermore, how can I determine what the selected
  1104. >portion is? 
  1105.  
  1106. You don't need to write an event filter to do this. Make sure that in your
  1107. DITL, the editText items are enabled (meaning ModalDialog() will return when
  1108. the user interacts with them). Call ModalDilaog() in a loop and check the
  1109. itemHit parameter for one of the editText item numbers.
  1110.  
  1111. When ModalDialog() indicates that an editText item was touched, grab the
  1112. TEHandle stored in the dialog record and examine the selStart and selEnd
  1113. fields (I may have those names wrong, look in IM: Text). If these fields
  1114. contain the same value, there is no selection (it's an insertion point).
  1115. If they contain differing values, there is a selection and the values are
  1116. indices into the raw text of the text edit record. Simply grab the text
  1117. between these indices (including the lower index and excluding the upper
  1118. index, I _think_; check this in IM: Text as well).
  1119.  
  1120. --Chris
  1121. _______________________________________________________________________________
  1122. Chris Larson -- Amateur Macintosh Geek, CoBase Research Assistant
  1123. L.A. Institute of Slowly and Painfully Working Out the Surprisingly Obvious
  1124. - -------------------------------------+---------------------------------------
  1125. (Insert Disclaimer Here)               | Who's the man ridin' in the sun?
  1126. UCLA Bruins--1995 NCAA Men's Basketball| Who's the man with the itchy gun?
  1127.              National Champions (yea!) | Who's the man who kills for fun?
  1128. Internet: larson@kingston.cs.ucla.edu  | Psycho Dad, Psycho Dad, PSYCHO DAD!
  1129.  
  1130. +++++++++++++++++++++++++++
  1131.  
  1132. >From dnewman@mail.utexas.edu (David Newman)
  1133. Date: Thu, 15 Jun 1995 11:56:22 -0500
  1134. Organization: University of Texas Department of Philosophy
  1135.  
  1136. Sam,
  1137.  
  1138. Again, assuming that I understand your problem, you don't need to filter
  1139. out mouse events, but key events to prevent the user from editing the text
  1140. that you want them to select from.  In addition, after the user has
  1141. dismissed the dialog, and before you dispose it, you can get the TEHandle
  1142. from the dialog, and use the following procedure to get the selection from
  1143. it as a string.
  1144.  
  1145. I assume that there is only one editable text item in the dialog. Also,
  1146. the procedure setStringLength sets the length byte of a string to be what
  1147. I want it to be, regardless
  1148. of the contents of the string.
  1149.  
  1150.  procedure getTESelection (theTERec: TEHandle;
  1151.        var theString: str255);
  1152.  
  1153. { A procedure to get the selected text of a TE record as a str255. }
  1154.  
  1155.   var
  1156.    tempString: str255;
  1157.    theStart, theEnd, theLength: integer;
  1158.    theText: charsHandle;
  1159.  
  1160.  begin
  1161.   tempString := '';
  1162.   theText := TEGetText(theTERec);
  1163.   theStart := theTERec^^.selStart;
  1164.   theEnd := theTERec^^.selEnd - 1;
  1165.   theLength := theEnd - theStart + 1;
  1166.   if theLength > 0 then begin
  1167.     hLock(handle(theText));
  1168.     if theLength <= 255 then begin
  1169.       setStringLength(tempString, theLength);
  1170.       blockMove(@theText^^[theStart], @tempString[1], theLength);
  1171.      end;
  1172.     hUnlock(handle(theText));
  1173.    end;
  1174.   theString := tempString;
  1175.  end; { getTESelection }
  1176.  
  1177. ---------------------------
  1178.  
  1179. >From jens_alfke@powertalk.apple.com (Jens Alfke)
  1180. Subject: Licensing the PEF format: the answer
  1181. Date: Tue, 6 Jun 1995 17:02:39 GMT
  1182. Organization: Apple Computer, Inc.
  1183. There were some questions a while back about the PEF format (the format
  1184. for executable code on PowerMacs and CFM68K) and how to get the details
  1185. from Apple. As promised, I asked people around here and got the following
  1186. official response:
  1187.  
  1188. "The PEF file format is patented. We widely license the format. For a
  1189. commercial product, the license fee is $250.00 forever. For non-commercial
  1190. products, the license fee is $0.00 forever. [I.e. free.]
  1191. Anyone that is interested in licensing should contact
  1192. SW.LICENSE@AppleLink.Apple.COM."
  1193.  
  1194. Sounds pretty reasonable to me.
  1195.  
  1196.  
  1197. Jens Alfke_________OpenDoc Geometer_________jens_alfke@powertalk.apple.com
  1198.                                            OpenDoc info: FTP to CILabs.org
  1199.  
  1200.                 LLAMA: NO FEAR OF SPIKES
  1201.  
  1202. +++++++++++++++++++++++++++
  1203.  
  1204. >From d88-bli@xbyse.nada.kth.se (Bo Lindbergh)
  1205. Date: 8 Jun 1995 20:55:20 GMT
  1206. Organization: Royal Institute of Technology, Stockholm, Sweden
  1207.  
  1208. In article <jens_alfke-0606951002390001@jensothermac.apple.com> jens_alfke@powertalk.apple.com (Jens Alfke) writes:
  1209. ) "The PEF file format is patented. We widely license the format. For a
  1210. ) commercial product, the license fee is $250.00 forever. For non-commercial
  1211. ) products, the license fee is $0.00 forever. [I.e. free.]
  1212. ) Anyone that is interested in licensing should contact
  1213. ) SW.LICENSE@AppleLink.Apple.COM."
  1214.  
  1215. Hmm.  What's the patent number?  And where is the revolutionary new idea
  1216. that allowed it to be patented? :-)
  1217.  
  1218.  
  1219. /Bo Lindbergh
  1220.  
  1221. +++++++++++++++++++++++++++
  1222.  
  1223. >From johnmce@world.std.com (John McEnerney)
  1224. Date: Fri, 9 Jun 1995 00:41:03 GMT
  1225. Organization: Metrowerks, Inc.
  1226.  
  1227. In article <3r7o3o$n8u@news.kth.se>, d88-bli@xbyse.nada.kth.se (Bo
  1228. Lindbergh) wrote:
  1229.  
  1230. > ) "The PEF file format is patented. We widely license the format. For a
  1231. > ) commercial product, the license fee is $250.00 forever. For non-commercial
  1232. > ) products, the license fee is $0.00 forever. [I.e. free.]
  1233. > ) Anyone that is interested in licensing should contact
  1234. > ) SW.LICENSE@AppleLink.Apple.COM."
  1235. > Hmm.  What's the patent number?  And where is the revolutionary new idea
  1236. > that allowed it to be patented? :-)
  1237.  
  1238. There are apparently several issues that were patentable. One was possibly
  1239. the scheme used to determine whether a client and library versions are
  1240. compatible. Another was almost certainly the design for representing
  1241. relocation information; consider that PEF can represent relocations for a
  1242. very large programs in only a few hundred bytes. Other commercial
  1243. executable file formats (e.g. XCOFF) require orders of magnitude more
  1244. space to represent the needed runtime relocations.
  1245.  
  1246. PEF is a nice piece of work!
  1247.  
  1248. -- 
  1249. John McEnerney (mcenerney@metrowerks.com)
  1250. Metrowerks PowerPC Compiler Architect
  1251.  
  1252. +++++++++++++++++++++++++++
  1253.  
  1254. >From Mark.R.Valence@dartmouth.edu (kurash@dartmouth.edu)
  1255. Date: 9 Jun 1995 15:23:01 GMT
  1256. Organization: Dartmouth College, Hanover, NH
  1257.  
  1258. In article <johnmce-0806952041420001@192.0.2.1>
  1259. johnmce@world.std.com (John McEnerney) writes:
  1260. > In article <3r7o3o$n8u@news.kth.se>, d88-bli@xbyse.nada.kth.se (Bo
  1261. > Lindbergh) wrote:
  1262. > > ) "The PEF file format is patented. We widely license the format. For a
  1263. > > ) commercial product, the license fee is $250.00 forever. For non-commercial
  1264. > > ) products, the license fee is $0.00 forever. [I.e. free.]
  1265. > > ) Anyone that is interested in licensing should contact
  1266. > > ) SW.LICENSE@AppleLink.Apple.COM."
  1267. > > 
  1268. > > Hmm.  What's the patent number?  And where is the revolutionary new idea
  1269. > > that allowed it to be patented? :-)
  1270. > There are apparently several issues that were patentable. One was possibly
  1271. > the scheme used to determine whether a client and library versions are
  1272. > compatible. Another was almost certainly the design for representing
  1273. > relocation information; consider that PEF can represent relocations for a
  1274. > very large programs in only a few hundred bytes. Other commercial
  1275. > executable file formats (e.g. XCOFF) require orders of magnitude more
  1276. > space to represent the needed runtime relocations.
  1277.  
  1278. It is my understanding that the packing algorithm (which is an RLE
  1279. scheme) is also one of the patented parts.  This is understandable
  1280. (that it would be patentable in the eyes of PTO, that is) because most
  1281. of the compression engines available today are patented.
  1282.  
  1283. > PEF is a nice piece of work!
  1284.  
  1285. Yes, that is an understatement.  Compare it to most other executable
  1286. file formats, especially Windows and COFF (Windows NT/95), and you will
  1287. see why Apple deserves credit.
  1288.  
  1289. Mark.
  1290.  
  1291. ---------------------------
  1292.  
  1293. >From rus@newsedge.com (Russell N. Sheptak)
  1294. Subject: MacTCP and Native code
  1295. Date: Thu, 08 Jun 1995 18:20:17 -0700
  1296. Organization: Desktop Data, Inc.
  1297.  
  1298. In moving my application native, I ran into some real performance
  1299. problems with native code and MacTCP.  I assume its the context
  1300. switches in the completion routines that are killing me.  Is this
  1301. another case of code better left in the 68K world?  If not, what's
  1302. the best (performance) way to deal with the problem?  Loadable
  1303. 68K stand-alone code resource?  Suggestions welcome.
  1304.  
  1305. rus
  1306.  
  1307. +++++++++++++++++++++++++++
  1308.  
  1309. >From scouten@metrowerks.com (Eric Scouten)
  1310. Date: Fri, 09 Jun 1995 02:54:50 -0500
  1311. Organization: Metrowerks, Inc.
  1312.  
  1313. In article <rus-0806951820170001@dynamic-222.dnai.com>, rus@newsedge.com
  1314. (Russell N. Sheptak) wrote:
  1315.  
  1316. > In moving my application native, I ran into some real performance
  1317. > problems with native code and MacTCP.  I assume its the context
  1318. > switches in the completion routines that are killing me.  Is this
  1319. > another case of code better left in the 68K world?  If not, what's
  1320. > the best (performance) way to deal with the problem?  Loadable
  1321. > 68K stand-alone code resource?  Suggestions welcome.
  1322.  
  1323. If you're writing code that calls MacTCP asynchronously, you should at
  1324. least make your completion routines in 68K. This will boost your
  1325. performance, since MacTCP is in 68K mode already.
  1326.  
  1327. If your completion routine needs only minimal access to your data
  1328. structures (and no access to global variables), you can accomplish this
  1329. fairly easily with a standalone code resource. (See my TurboTCP library as
  1330. an example.) It's probably not necessary from a performance standpoint to
  1331. write the rest of your program in 68K; I/O bandwidth will be the primary
  1332. bottleneck anyway.
  1333.  
  1334. FYI, under optimal conditions (unbusy Ethernet, unbusy server, no other
  1335. apps running, etc.) MacTCP will max out at about ~410KB/sec (receive).
  1336. Anything beyond this is probably out of reach, no matter how well you've
  1337. written your code (at least until Open Transport comes along).
  1338.  
  1339. -es
  1340.  
  1341. __________________________________________________________________________
  1342. Eric Scouten                                       Constructor Constructor
  1343. scouten@metrowerks.com                                     Metrowerks, Inc.
  1344.  
  1345. The Pledge of Allegiance says, "liberty and justice for all."
  1346. Which part of "all" don't you understand?
  1347.    -Rep. Pat Schroeder
  1348.  
  1349. +++++++++++++++++++++++++++
  1350.  
  1351. >From peter@mail.peter.com.au (Peter N Lewis)
  1352. Date: Thu, 15 Jun 1995 13:31:23 +0800
  1353. Organization: Curtin University
  1354.  
  1355. In article <rus-0806951820170001@dynamic-222.dnai.com>, rus@newsedge.com
  1356. (Russell N. Sheptak) wrote:
  1357.  
  1358. >In moving my application native, I ran into some real performance
  1359. >problems with native code and MacTCP.  I assume its the context
  1360. >switches in the completion routines that are killing me.  Is this
  1361. >another case of code better left in the 68K world?  If not, what's
  1362. >the best (performance) way to deal with the problem?  Loadable
  1363. >68K stand-alone code resource?  Suggestions welcome.
  1364.  
  1365. I haven't bothered going native with my code for exactly this reason. 
  1366. However, other apps (like NewsWatcher and Eudora) don't seem to suffer too
  1367. badly in performance.  Perhaps check out Fetch too, it's Native and
  1368. requires high performance networking, see how it compares to running
  1369. emulated Anarchie...?
  1370.    Peter.
  1371.  
  1372. +++++++++++++++++++++++++++
  1373.  
  1374. >From mta@umich.edu (Mike Alexander)
  1375. Date: Thu, 15 Jun 1995 21:35:50 -0400
  1376. Organization: University of Michigan
  1377.  
  1378. In article <rus-0806951820170001@dynamic-222.dnai.com>, rus@newsedge.com
  1379. (Russell N. Sheptak) wrote:
  1380.  
  1381. > In moving my application native, I ran into some real performance
  1382. > problems with native code and MacTCP.  I assume its the context
  1383. > switches in the completion routines that are killing me.  Is this
  1384. > another case of code better left in the 68K world?  If not, what's
  1385. > the best (performance) way to deal with the problem?  Loadable
  1386. > 68K stand-alone code resource?  Suggestions welcome.
  1387.  
  1388. The best medium to long term solution is to use Open Transport, which is
  1389. potentially native right down to the wire depending on the particular
  1390. transport protocol being used.  Of course, this doesn't help much until
  1391. most people have Open Transport which won't happen for a while.  In the
  1392. meantime, it's probably not worth putting a lot of effort into solving
  1393. this problem with the old MacTCP.
  1394.  
  1395. Mike Alexander              Internet:       mta@umich.edu
  1396. University of Michigan      America Online: MAlexander
  1397. ITD - Research Systems      AppleLink:      UMICH
  1398.  
  1399. ---------------------------
  1400.  
  1401. >From snyder@pendragon.jsc.nasa.gov
  1402. Subject: MacTech vs. develop
  1403. Date: 14 Jun 95 12:53:31 CST
  1404. Organization: Johnson Space Center; Houston, Tx
  1405.  
  1406. Hello,
  1407.  
  1408. A quick question to all you experienced Mac Hackers...
  1409.  
  1410. Which would be a more useful subscription for a beginner-to-intermediate Mac
  1411. programmer, MacTech ($40/yr through AOL) or d e v e l o p ($30/yr APDA)?  I've
  1412. looked at single issues of both, and they both seem to have their merits.
  1413.                                                                
  1414. One advantage of MacTech are 12 issues (vs. 4 for develop) a year.  Develop,
  1415. however, seems to have more substance per issue.  You also get the bookmark
  1416. CD's with develop with all the back issues, IM's, etc.   How important are the
  1417. bookmark CD's, really?  It seems that a lot of the material is redundant after
  1418. you have a few.  I bought develop #17 single issue, so I have most of the
  1419. "essential" (for my current level of competance, anyway) volumes of IM.
  1420.                                                                        
  1421. Anyway, my wife asked me what I wanted for Father's Day, and I need to give her
  1422. an answer soon or else I think I'll be getting another tie :)
  1423.  
  1424. All opinions are welcome.
  1425.  
  1426. Thanks,
  1427. russ
  1428. snyder@tcd.jsc.nasa.gov
  1429.  
  1430. +++++++++++++++++++++++++++
  1431.  
  1432. >From geek@nwu.edu (Joey Gray)
  1433. Date: Thu, 15 Jun 1995 09:46:26 -0500
  1434. Organization: Northwestern University
  1435.  
  1436. In article <1995Jun14.125331.1@pendragon.jsc.nasa.gov>,
  1437. snyder@pendragon.jsc.nasa.gov wrote:
  1438.  
  1439. >Which would be a more useful subscription for a beginner-to-intermediate Mac
  1440. >programmer, MacTech ($40/yr through AOL) or d e v e l o p ($30/yr APDA)?  I've
  1441. >looked at single issues of both, and they both seem to have their merits.
  1442.  
  1443. that probably depends on just how experienced you are, and what you're
  1444. looking for. develop seems to concentrate on some of the newer and/or more
  1445. difficult issues of macintosh programming, while mactech seems to
  1446. concentrate on the more mundane, day-to-day types of things that macintosh
  1447. programmers face. not that they both don't have exceptions to this, it's
  1448. just my take on the relative uses of the magazines. i have had a
  1449. subscription to both for a couple of years now, and very much enjoy both
  1450. of them. hey, ask for both!
  1451.  
  1452. >One advantage of MacTech are 12 issues (vs. 4 for develop) a year.  Develop,
  1453. >however, seems to have more substance per issue.  You also get the bookmark
  1454. >CD's with develop with all the back issues, IM's, etc.   How important are the
  1455. >bookmark CD's, really?  It seems that a lot of the material is redundant after
  1456. >you have a few.  I bought develop #17 single issue, so I have most of the
  1457. >"essential" (for my current level of competance, anyway) volumes of IM.
  1458.  
  1459. yes, the cd's do become a bit redundant. unless some example code is
  1460. updated, or new example code is added, that portion of the cd seems to
  1461. remain pretty much the same. the good stuff on each cd is the code and
  1462. example programs (and what not) that are discussed in the magazine. i'm
  1463. not sure if that stuff is duplicated on each subsequent cd, but i doubt
  1464. it.
  1465.  
  1466. >Anyway, my wife asked me what I wanted for Father's Day, and I need to give her
  1467. >an answer soon or else I think I'll be getting another tie :)
  1468.  
  1469. a tie!?! just say "no" to the noose!
  1470.  
  1471. >All opinions are welcome.
  1472.  
  1473. you asked for it.
  1474.  
  1475. -joey
  1476. =====================================================================
  1477. Joey Gray                       | geek@nwu.edu
  1478. School of Education             | (708) 467-1704
  1479. Northwestern University         +------------------------------------
  1480. **Bandwagon disclaimer:         | "Anybody can cook with gas --
  1481.    My opinions are mine, not my |  it takes the French to cook with
  1482.    employer's. so there!        |  magnets!" - old newsreel
  1483. =====================================================================
  1484.  
  1485. +++++++++++++++++++++++++++
  1486.  
  1487. >From sbryan@maroon.tc.umn.edu (Steve Bryan)
  1488. Date: Thu, 15 Jun 1995 15:24:08 GMT
  1489. Organization: Sexton Software
  1490.  
  1491. In article <1995Jun14.125331.1@pendragon.jsc.nasa.gov>,
  1492. snyder@pendragon.jsc.nasa.gov wrote:
  1493.  
  1494. > Which would be a more useful subscription for a beginner-to-intermediate Mac
  1495. > programmer, MacTech ($40/yr through AOL) or d e v e l o p ($30/yr APDA)?  I've
  1496. > looked at single issues of both, and they both seem to have their merits.
  1497. ...
  1498. > Anyway, my wife asked me what I wanted for Father's Day, and I need to
  1499. give her
  1500. > an answer soon or else I think I'll be getting another tie :)
  1501.  
  1502.  
  1503. Ask her for MacTech and order develop yourself. Seriously I would strongly
  1504. suggest getting both. It is not at all redundant like subscribing to
  1505. MacWorld and MacUser where you get the same ads twice.
  1506.  
  1507. -- 
  1508. |Steve Bryan                Internet: sbryan@maroon.tc.umn.edu
  1509. |Sexton Software          CompuServe: 76545,527
  1510. |Minneapolis, MN 55415           Fax: (612) 929-1799
  1511. |PGP key fingerprint: B4 C6 E2 A6 5F 87 57 7D  E1 8C A6 9B A9 BE 96 CB
  1512.  
  1513. +++++++++++++++++++++++++++
  1514.  
  1515. >From online@xplain.com (John Kawakami)
  1516. Date: Fri, 16 Jun 1995 03:11:09 GMT
  1517. Organization: Xplain Corp.
  1518.  
  1519. In article <1995Jun14.125331.1@pendragon.jsc.nasa.gov>,
  1520. snyder@pendragon.jsc.nasa.gov wrote:
  1521.  
  1522. > Hello,
  1523. > A quick question to all you experienced Mac Hackers...
  1524. > Which would be a more useful subscription for a beginner-to-intermediate Mac
  1525. > programmer, MacTech ($40/yr through AOL) or d e v e l o p ($30/yr APDA)?  I've
  1526. > looked at single issues of both, and they both seem to have their merits.
  1527. >                                                                
  1528. > One advantage of MacTech are 12 issues (vs. 4 for develop) a year.  Develop,
  1529. > however, seems to have more substance per issue.  You also get the bookmark
  1530. > CD's with develop with all the back issues, IM's, etc.   How important are the
  1531. > bookmark CD's, really?  It seems that a lot of the material is redundant after
  1532. > you have a few.  I bought develop #17 single issue, so I have most of the
  1533. > "essential" (for my current level of competance, anyway) volumes of IM.
  1534. >                                                                        
  1535. > Anyway, my wife asked me what I wanted for Father's Day, and I need to
  1536. give her
  1537. > an answer soon or else I think I'll be getting another tie :)
  1538. > All opinions are welcome.
  1539. > Thanks,
  1540. > russ
  1541. > snyder@tcd.jsc.nasa.gov
  1542.  
  1543. I'd say get both, but send the check to MacTech first <g>
  1544.  
  1545. The MacTech staff reads develop, and the develop people say they read
  1546. MacTech.  Those develop editors and writers are pretty darn smart, and I
  1547. think you should follow their lead and read MacTech.  The magazines don't
  1548. overlap that much; MacTech covers third party products as well as Apple
  1549. technology and programming techniques, while develop is heavily oriented
  1550. toward Apple technology.  MacTech has advertisements, so you can keep up
  1551. on third party tools and products.  And perhaps most importantly, MacTech
  1552. is not operated by Apple, it's an independent magazine.
  1553.  
  1554. As for develop's redundant CDs: it's impossible to create 600 MB of new
  1555. content every three months (unless you do something like create archives
  1556. of comp.sys.mac.programmer.* postings.)  And speaking of CDs, MacTech has
  1557. a nifty little CD with all the old MacTech articles in Think Reference
  1558. hypertext.
  1559.  
  1560. If any of you out there didn't already know, you can get a "online user
  1561. discount" off the regular subscription price by filling out a form
  1562. available on ftp://ftp.netcom.com/pub/xp/xplain
  1563. John Kawakami, online@xplain.com
  1564.  
  1565. - -MacTech Magazine--------------------------------------------------
  1566. PO Box 250055, Los Angeles, CA 90025, 310-575-4343, Fax:310-575-0925
  1567. For more info, ftp://ftp.netcom.com/pub/xp/xplain
  1568.  
  1569. +++++++++++++++++++++++++++
  1570.  
  1571. >From shawn@news.mdli.com (Shawn Lavin)
  1572. Date: 16 Jun 1995 17:58:04 GMT
  1573. Organization: HoloNet National Internet Access System: 510-704-1058/modem
  1574.  
  1575. snyder@pendragon.jsc.nasa.gov wrote:
  1576.  
  1577. > Which would be a more useful subscription for a beginner-to-intermediate Mac
  1578. > programmer, MacTech ($40/yr through AOL) or d e v e l o p ($30/yr APDA)?  I've
  1579. > looked at single issues of both, and they both seem to have their merits.
  1580.  
  1581. Add my vote to the 'both' catagory. They address different concerns and
  1582. both consistantly contain a wealth of good articles. Get her to order
  1583. MacTech for you and buy d e v e l o p yourself (that way she can see
  1584. her gift arriving 12 times). I have had subscriptions to both for years
  1585. and have never considered letting them lapse.
  1586.  
  1587. I consider these essential for the hobbyist Mac programmer, and not
  1588. a bad idea for the prefessional.
  1589.  
  1590. --
  1591. Shawn Lavin
  1592. (shawn@mdli.com)
  1593.  
  1594. As always, my opinions are my own
  1595.  
  1596. ---------------------------
  1597.  
  1598. >From jshazen@netcom.com (john hazen)
  1599. Subject: MacsBug Docs? (was Re: Where are the @$# keyUp events?!!)
  1600. Date: Thu, 8 Jun 1995 00:04:02 GMT
  1601. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  1602.  
  1603.  
  1604. I've been looking on and off for the docs on how to use MacsBug for 2 
  1605. months now.  I've looked on various developer CDs and on the CodeWarrior 
  1606. CD.  Can anyone out there point me in the right direction?
  1607.  
  1608. Thanks in advance.
  1609.  
  1610. John Hazen
  1611.  
  1612. +++++++++++++++++++++++++++
  1613.  
  1614. >From alain@cs.uchicago.edu (Alain Roy)
  1615. Date: Thu, 8 Jun 1995 15:23:50 GMT
  1616. Organization: None
  1617.  
  1618. In article <jshazenD9tuur.MH1@netcom.com>, jshazen@netcom.com (john hazen)
  1619. wrote:
  1620.  
  1621. >I've been looking on and off for the docs on how to use MacsBug for 2 
  1622. >months now.  I've looked on various developer CDs and on the CodeWarrior 
  1623. >CD.  Can anyone out there point me in the right direction?
  1624.  
  1625. I learned much of Macsbug from the builtin help. Type 'help' when in Macsbug.
  1626.  
  1627. The only manual I know of, you have to buy. Oh well, at least the debugger
  1628. is free. Also, the manual covers version 6.2.2--for the most part that's
  1629. ok. If you read the release notes with macsbug, you should be set.
  1630.  
  1631. I think that it's quite a good manual. Here's the Table of Contents:
  1632.  
  1633. 1. Macsbug & Low-Level Debugger
  1634. 2. Getting Started
  1635. 3. An Assembly Language Primer
  1636. 4. Macintosh Memory Organization
  1637. 5. The Macintosh Operating System
  1638. 6. Discipline
  1639. 7. Debugging Strategies
  1640. 8. Introduction to Macsbug Commands
  1641. 9. Macsbug Commands.
  1642.  
  1643. It's called _MacsBug References and Debugging Guide_
  1644. Subtitled: "For MacBug version 6.2"
  1645. ISBN 0-201-56767-9
  1646. $24.95/USA
  1647. $31.95/Canada
  1648.  
  1649. Hope this helps.
  1650.  
  1651. I've been thinking of writing a MacsBug FAQ. Anyone want to donate their
  1652. favorite MacsBugs tips or tricks?
  1653.  
  1654. -alain
  1655.  
  1656. ---------------------------
  1657.  
  1658. >From tasc0001@gold.tc.umn.edu (Scott Taschler)
  1659. Subject: Overwhelmed newbie needs encouragement
  1660. Date: Tue, 6 Jun 1995 01:58:38 GMT
  1661. Organization: University of Minnesota
  1662.  
  1663. Hello everyone,
  1664.  
  1665. I've recently begun to try to pick up some Mac programming.  I've got a
  1666. few of the Inside Mac books, as well as Dave Mark's book, and have gone
  1667. through the examples.  This toolbox stuff is driving me buggy!  There is
  1668. so much to understand, I have become overwhelmed to the point that it
  1669. seems like a mammoth undertaking to even try a *small* mac project.  Even
  1670. printing an error message takes a major effort.  Required AppleEvents,
  1671. proper preference files, being background friendly...you see my point.
  1672.  
  1673. So, what advice can you veterans out there give to help me get up to
  1674. speed?  A few ideas that I have thought of are:
  1675.  
  1676. o  Finding a good library out there that provides the basic framework for
  1677. an application, so I can just fill in the unique details of my app  
  1678.  
  1679. o  A good toolkit to isolate some of the complications of the toolbox?
  1680. (ala Tcl/Tk in the UNIX world.)
  1681.  
  1682. o  Perhaps a good class library is what I need.  TC++ has the Visual
  1683. Architect, which looks promising, but the Think Class Library is hardly
  1684. any more simple than the standard toolbox, is it?
  1685.  
  1686. Any pointers will be gratefully gulped down.  I can't be the only one out
  1687. here that has become frustrated with the daunting task of trying to master
  1688. the toolbox.
  1689.  
  1690. - -------------------------------------------------------------------
  1691. Scott "Scooter" Taschler  \  "We should tackle reality in a slightly
  1692. University of Minnesota   \   joky way, otherwise we miss its point"
  1693. tasc0001@gold.tc.umn.edu  \   --Lawrence Durrel
  1694.  
  1695. +++++++++++++++++++++++++++
  1696.  
  1697. >From ellens@bnr.ca (Chris Ellens)
  1698. Date: Tue, 06 Jun 1995 08:57:21 -0400
  1699. Organization: BNR
  1700.  
  1701. In article <tasc0001-0506951958380001@dialup-4-60.gw.umn.edu>,
  1702. tasc0001@gold.tc.umn.edu (Scott Taschler) wrote:
  1703.  
  1704. ] Hello everyone,
  1705. ] I've recently begun to try to pick up some Mac programming.  I've got a
  1706. ] few of the Inside Mac books, as well as Dave Mark's book, and have gone
  1707. ] through the examples.  This toolbox stuff is driving me buggy!  There is
  1708. ] so much to understand, I have become overwhelmed to the point that it
  1709. ] seems like a mammoth undertaking to even try a *small* mac project.  Even
  1710. ] printing an error message takes a major effort.  Required AppleEvents,
  1711. ] proper preference files, being background friendly...you see my point.
  1712. ] So, what advice can you veterans out there give to help me get up to
  1713. ] speed?  A few ideas that I have thought of are:
  1714. ] o  Finding a good library out there that provides the basic framework for
  1715. ] an application, so I can just fill in the unique details of my app  
  1716. ] o  A good toolkit to isolate some of the complications of the toolbox?
  1717. ] (ala Tcl/Tk in the UNIX world.)
  1718. ] o  Perhaps a good class library is what I need.  TC++ has the Visual
  1719. ] Architect, which looks promising, but the Think Class Library is hardly
  1720. ] any more simple than the standard toolbox, is it?
  1721. ] Any pointers will be gratefully gulped down.  I can't be the only one out
  1722. ] here that has become frustrated with the daunting task of trying to master
  1723. ] the toolbox.
  1724.  
  1725.  
  1726. You're right, you're not the only one. However everything suddenly seems
  1727. less daunting when you start to realize how much that toolbox (and a good
  1728. framework like the TCL) does for you that you don't have to code/debug
  1729. yourself.
  1730.  
  1731. If you're comfortable with C (with C++ even better) then I recommend the
  1732. Think Class Library. It serves a different purpose than the toolbox -
  1733. think of it as an application "shell" - a generic application that you
  1734. just tweak to get what you want. However be prepared for lots more
  1735. frustration when you first dive into it, especially if you're new to
  1736. object-oriented programming. You have to twist your brain for a while
  1737. before you start to see things the oop (and TCL) way.
  1738.  
  1739. I've been struggling to teach myself C, C++, OOP, TCL, and the Mac toolbox
  1740. in my (limited) spare time for about a year now, and I'm an experienced
  1741. programmer (PL/I, Fortran, and Pascal). A few months ago it was like
  1742. waking up - when this whole TCL thing started to make sense. Now I'm
  1743. amazed at how obvious it is what I have to do to add a new feature to my
  1744. code.
  1745.  
  1746. There's also Visual Architect, which allows you to design an interface on
  1747. your screen and get it running almost instantaneously. Then you can go
  1748. poke around the generated (TCL) code and try to figure out how it works.
  1749.  
  1750. If you're not tied to C and C++ and you have a bit of cash to blow, you
  1751. could also check out Prograph, which is a whole new way to program.
  1752. There's a demo CD available (I think - I haven't received mine yet) -
  1753. maybe somebody else here can comment on that.
  1754.  
  1755. -- 
  1756. Chris Ellens       ellens@bnr.ca
  1757.  
  1758. +++++++++++++++++++++++++++
  1759.  
  1760. >From dstone@chem.utoronto.ca (David Stone)
  1761. Date: Tue, 6 Jun 1995 13:13:28 GMT
  1762. Organization: University of Toronto Chemistry
  1763.  
  1764. In article <tasc0001-0506951958380001@dialup-4-60.gw.umn.edu>,
  1765. tasc0001@gold.tc.umn.edu (Scott Taschler) wrote:
  1766. > Hello everyone,
  1767. > I've recently begun to try to pick up some Mac programming.  I've got a
  1768. > few of the Inside Mac books, as well as Dave Mark's book, and have gone
  1769. > through the examples.  This toolbox stuff is driving me buggy!  There is
  1770. > so much to understand, I have become overwhelmed to the point that it
  1771. > seems like a mammoth undertaking to even try a *small* mac project.  Even
  1772. > printing an error message takes a major effort.  Required AppleEvents,
  1773. > proper preference files, being background friendly...you see my point.
  1774. > So, what advice can you veterans out there give to help me get up to
  1775. > speed?  A few ideas that I have thought of are:
  1776. <SNIP>
  1777.  
  1778.  
  1779. One thing I found helpful at first was using Prototyper when I first
  1780. started Mac programming.  This allowed be to design the user interface
  1781. and generated all the code I needed for the basic application framework
  1782. (including dialogs, alerts, windows, menus, controls...).  I have to
  1783. confess that I don't use it any more, but a tool like that is great
  1784. when you're just starting out.
  1785.  
  1786. I found the Think Class Library too overwhelming, even though I'd been
  1787. on the Mac about 3 years by the time I started using it.  I still use
  1788. the object extensions in SC 6, though (haven't graduated to C++ yet).
  1789.  
  1790. Don't get too hung up on making your first application(s) perfect -
  1791. you can go back and redo them later if you want to.  My first attempts
  1792. were all multifinder-ignorant and still ignore AppleEvents, but they
  1793. work fine and I keep fixing things as we go along (I will get around
  1794. to AE's one day...)
  1795.  
  1796. When I'm in a real hurry, I still (gasp!) use the SC 6 console window
  1797. with printf/scanf and no menus....you do what you have to do.
  1798.  
  1799. Keep at it, though - it really is worth the effort and it's a great
  1800. reward when people say how impressed they are with this professional-
  1801. -looking software you wrote!
  1802.  
  1803. Dave Stone
  1804.  
  1805. +++++++++++++++++++++++++++
  1806.  
  1807. >From pottier@drakkar.ens.fr (Francois Pottier)
  1808. Date: 6 Jun 1995 16:42:18 GMT
  1809. Organization: Ecole Normale Superieure, Paris
  1810.  
  1811. In article <tasc0001-0506951958380001@dialup-4-60.gw.umn.edu>,
  1812. Scott Taschler <tasc0001@gold.tc.umn.edu> wrote:
  1813.  
  1814. >o  Perhaps a good class library is what I need.
  1815.  
  1816. A good class library is definitely useful, but you will have a hard time
  1817. understanding how to use it at first, especially if you don't master the
  1818. Toolbox. I'm learning PowerPlant and it takes quite a bit of single-stepping
  1819. to get a general picture.
  1820.  
  1821. I would recommend getting a small framework such as TransSkel, which handles
  1822. the event handling mechanism for you, and understanding it well. Then you
  1823. can move on.
  1824.  
  1825. Good luck!
  1826.  
  1827.  
  1828. -- 
  1829. Francois Pottier                                            pottier@dmi.ens.fr
  1830. - ----------------------------------------------------------------------------
  1831. Check my WWW page at http://acacia.ens.fr:8080/home/pottier/ ...
  1832.  
  1833. +++++++++++++++++++++++++++
  1834.  
  1835. >From rdavis@cybernetics.net (Ron Davis)
  1836. Date: Tue, 06 Jun 1995 12:34:39 -0400
  1837. Organization: Datawatch Corp
  1838.  
  1839. In article <tasc0001-0506951958380001@dialup-4-60.gw.umn.edu>,
  1840. tasc0001@gold.tc.umn.edu (Scott Taschler) wrote:
  1841.  
  1842. >through the examples.  This toolbox stuff is driving me buggy!  There is
  1843. >so much to understand, I have become overwhelmed to the point that it
  1844. >seems like a mammoth undertaking to even try a *small* mac project.  Even
  1845. >printing an error message takes a major effort.  Required AppleEvents,
  1846.  
  1847. I can remember feeling this way too.  You have to make a paradigm shift to
  1848. get into the GUI/event loop kind of thinking.  Start small and work your
  1849. way up.
  1850.  
  1851. >proper preference files, being background friendly...you see my point.
  1852. >
  1853. >So, what advice can you veterans out there give to help me get up to
  1854. >speed?  A few ideas that I have thought of are:
  1855.  
  1856. Here's some basic advice.  Start building a simple C shell.  You can
  1857. search around on the Net and find a few already there, but I'd suggest you
  1858. build your own rather than use someone elses.  Build a little at a time
  1859. like this.
  1860.  
  1861.  
  1862.    You have to make these calls but I don't think I've every written one from
  1863.    scratch.
  1864.  
  1865.  
  1866.    This would call GetNewMBar and handle adding the Apple menu.
  1867.  
  1868.    Call GetNewWindow and put up your window.
  1869.  
  1870.    Call WaitNextEvent and have a switch statement for all of the events.
  1871.  
  1872.    Branch off your event loop.  You should probably handle menu events first
  1873.    or you'll never be able to quit.
  1874.  
  1875.    you learn something new.
  1876.  
  1877. Hope that helps.
  1878.  
  1879. __________________________________________________________________
  1880. "I want to know God's thoughts...the rest are details."
  1881.                                            -- Albert Einstein
  1882. _________________________________________
  1883. Ron Davis           Software Engineer       rondavis@datawatch.com 
  1884.                     Finger rdavis@server0.cybernetics.net for PGP key.
  1885.                http://www.cybernetics.net/users/rdavis/home.html
  1886. Opinions are MINE - Datawatch doesn't pay me enough to own my opinions.
  1887.  
  1888. +++++++++++++++++++++++++++
  1889.  
  1890. >From dlacasse@crim.ca (Denis Lacasse)
  1891. Date: Wed, 7 Jun 1995 12:34:02 GMT
  1892. Organization: Centre de Recherche Informatique de Montrial
  1893.  
  1894. dstone@chem.utoronto.ca (David Stone) wrote:
  1895.  
  1896. [snip]
  1897.  
  1898. >One thing I found helpful at first was using Prototyper when I first
  1899.  
  1900. [snip]
  1901.  
  1902. Can you give more info on Prototyper? like is it still availble? How
  1903. much ?  What does it do?
  1904.  
  1905. Thanks!
  1906.  
  1907.  
  1908. +++++++++++++++++++++++++++
  1909.  
  1910. >From ffllanagan@aol.com (FFllanagan)
  1911. Date: 7 Jun 1995 12:58:27 -0400
  1912. Organization: America Online, Inc. (1-800-827-6364)
  1913.  
  1914.  
  1915. >through the examples.  This toolbox stuff is driving me buggy!  There is
  1916. >so much to understand, I have become overwhelmed to the point that it
  1917. >seems like a mammoth undertaking to even try a *small* mac project.  Even
  1918. >printing an error message takes a major effort.  Required AppleEvents,
  1919. >proper preference files, being background friendly...you see my point.
  1920.  
  1921. I can remember that *very* well. What saved me was a wonderful skeleton
  1922. called TransSkel (by Paul DuBois et al). It makes the ToolBox much more
  1923. managable, and best of all, it's free. You can find it in all the usual
  1924. places, and it's compatible with THINK C, THINK Pascal, and Codewarrior.
  1925. It's definitely worth looking into.
  1926.  
  1927. Even with TransSkel, though, learning the ToolBox is *hard*. I've been
  1928. working with it for about a year and a half, maybe two years, and it's
  1929. still difficult for me. Be patient! :)
  1930.  
  1931. - Reid Priedhorsky
  1932.   (Author of Guy Smiley vs. the Monsters)
  1933.  
  1934. +++++++++++++++++++++++++++
  1935.  
  1936. >From clay1@primenet.com (Clayburn Juniel/Effective Software Solutions)
  1937. Date: 8 Jun 1995 15:39:12 GMT
  1938. Organization: Primenet Services for the Internet (602)395-1010
  1939.  
  1940. :   Branch off your event loop.  You should probably handle menu events first
  1941. :   or you'll never be able to quit.
  1942.  
  1943. By the way how do you get out of such a situation without rebooting?
  1944.  
  1945. I too am a newbie Mac programmer.  I started using Powerplant, but it 
  1946. looks like it adds so much stuff to your code.  And its like a toolbox on 
  1947. top of a tool box.  It does let you do some things without worrying about 
  1948. writing code, but I think in the long run it would be better to write 
  1949. that code yourself then you know exactly whats in it (until a few months 
  1950. pass by and you completely forget :) ).-- Clay
  1951.  
  1952. WARNING! Opinions may change due to new information. 
  1953. |--------------------------------------------------------------------|
  1954. |Effective Software Solutions   Clayburn W. Juniel, III              |
  1955. |Custom Software Design         1928 E. Camelback Rd. #623           |
  1956. |Phone:     (602)274-6905       Phoenix, AZ   85016-4143   USA       |
  1957. |Fax:       (602)274-6851                                            |
  1958. |Internet:  clay1@primenet.com  WWW:  http://www.primenet.com/~clay1 |
  1959. |           c.juniel@genie.com  FTP:  ftp.primenet.com  users/c/clay1|
  1960. |--------------------------------------------------------------------|
  1961.  
  1962.  
  1963. +++++++++++++++++++++++++++
  1964.  
  1965. >From pottier@chaland.ens.fr (Francois Pottier)
  1966. Date: 9 Jun 1995 09:17:02 GMT
  1967. Organization: Ecole Normale Superieure, Paris
  1968.  
  1969. In article <3r75j0$4i0@news4.primenet.com>,
  1970. Clayburn Juniel/Effective Software Solutions <clay1@primenet.com> wrote:
  1971.  
  1972. >I too am a newbie Mac programmer.  I started using Powerplant, but it 
  1973. >looks like it adds so much stuff to your code.  And its like a toolbox on 
  1974. >top of a tool box.
  1975.  
  1976. You're right. PowerPlant is a medium-sized framework. In my opinion,
  1977. it is not suitable for complete beginners; a beginner should first
  1978. try a smaller framework such as TransSkel or try to write his own.
  1979. This will let him understand how the Mac works. PowerPlant, TCL,
  1980. MacApp and others are quite large and are useful if you want to
  1981. write a big, full-fledged application which you want to distribute
  1982. and maintain over time. Different goals.
  1983.  
  1984. For instance, I am making my application scriptable using PowerPlant
  1985. and it is a breeze (well, not really, but considering how hairy the
  1986. AEOM is...). PowerPlant is suited for large projects, not for 
  1987. beginners.
  1988.  
  1989. Just my two cents, of course.
  1990.  
  1991.  
  1992.  
  1993.  
  1994. -- 
  1995. Francois Pottier                                            pottier@dmi.ens.fr
  1996. - ----------------------------------------------------------------------------
  1997. Check my WWW page at http://acacia.ens.fr:8080/home/pottier/ ...
  1998.  
  1999. +++++++++++++++++++++++++++
  2000.  
  2001. >From shawn@news.mdli.com (Shawn Lavin)
  2002. Date: 9 Jun 1995 16:25:09 GMT
  2003. Organization: HoloNet National Internet Access System: 510-704-1058/modem
  2004.  
  2005. Clayburn Juniel/Effective Software Solutions (clay1@primenet.com) wrote:
  2006.  
  2007. : I too am a newbie Mac programmer.  I started using Powerplant, but it 
  2008. : looks like it adds so much stuff to your code.  And its like a toolbox on 
  2009. : top of a tool box.  It does let you do some things without worrying about 
  2010. : writing code, but I think in the long run it would be better to write 
  2011. : that code yourself then you know exactly whats in it (until a few months 
  2012. : pass by and you completely forget :) ).-- Clay
  2013.  
  2014. The intended advantage to the frameworks are that they are already
  2015. written code for you to base your large projects off. They are supposed
  2016. to be well thought out, properly debugged and highly reliable. The
  2017. payoff for you is that after a lot less time studying them than you
  2018. would have spent writing and debugging them, you can start concentrating
  2019. on the unique bits that make your progrem unique.
  2020.  
  2021. That's the up side.
  2022.  
  2023. The down side, well since they are often everything and the kitchen sink
  2024. they tend to have a much larger disk/memory footprint than a custom written
  2025. program which only has the things that you want. In addition, if the   
  2026. framework designer was designing a document centered application and
  2027. you are doing a database (or game), the fit of the framework to your
  2028. model may be poor, resulting in lots of work arounds. Also, not all
  2029. frameworks out there are well thought out, properly debugged or reliable.
  2030.  
  2031. What does this mean from a practical point of view ?
  2032.  
  2033. For most people, if they are writing a simple, well defined application,
  2034. the frameworks are overkill. When you choose a framework for a project, you
  2035. should choose one that is suitable for your type of project. Remember
  2036. when you are studying a framework to use it that you alternative is to
  2037. actually write those hundreds of classes (and debug and fix them). 
  2038.  
  2039. --
  2040. Shawn Lavin
  2041. (shawn@mdli.com)
  2042.  
  2043. As always, my opinions are my own
  2044.  
  2045. +++++++++++++++++++++++++++
  2046.  
  2047. >From ernie@winternet.com (Ernie Soffronoff)
  2048. Date: 13 Jun 1995 16:04:50 GMT
  2049. Organization: StarNet Communications, Inc
  2050.  
  2051. I really like AppMaker.  It lets you draw the interface using grapic 
  2052. tools and then generates enough code to get all the interface working.  
  2053. You can then just plug your functional stuff in behind the menus and 
  2054. buttons and such.  It's possible to get a working Mac application in just 
  2055. a few hours.
  2056.  
  2057. That's how I did my first Mac application.  Now I end up changing more of 
  2058. the stuff generated by AppMaker and might stop using it completely, but I 
  2059. never would have gotten started if I hadn't used it.
  2060.  
  2061. There's a demo on the CW CD (at least there was in CW5, I haven't looked 
  2062. for it on CW6 yet).  And I think it's going to do PowerPlant too, which 
  2063. would be a good way to learn how to make a PowerPlant app.  (All I've 
  2064. done has been THINK Pascal and CW procedural C.)
  2065.  
  2066. --Ernie
  2067. ernie@winternet.com
  2068.  
  2069. +++++++++++++++++++++++++++
  2070.  
  2071. >From greer@utdallas.edu (Dale M Greer)
  2072. Date: 14 Jun 1995 05:36:58 GMT
  2073. Organization: The University of Texas at Dallas
  2074.  
  2075. Here's another vote for TransSkel.  It works well to get started, and 
  2076. you've got all the source code to teach you how to roll your own, or
  2077. you can just go in and alter it to suit your own purposes.  The complete
  2078. package includes TransDisplay and TransEdit, which make it very easy to
  2079. get text display and editing.  The package also comes with many examples,
  2080. with projects in three flavors: MPW, THINK, and Metrowerks.
  2081.  
  2082. It is also very small for a framework.  The "Hello" sample is about
  2083. 20K bytes.  I guess it isn't really a framework, but a skeleton.  Anyway,
  2084. it's small enough that you can look through the code and learn a lot
  2085. form it quickly, unlike most frameworks.
  2086.  
  2087. How come nobody's mentioned Sprocket?  I'll admit I've never used it, but
  2088. I just haven't gotten around to trying it out.
  2089.  
  2090. Finally, look into Apple's WWW and FTP sites for their code Snippets.
  2091. They've got a whole mess of examples for all of the older Mac software
  2092. managers.  Some of this code is getting a bit long in the tooth, but 
  2093. that's usually okay if you're just beginning.  The only addresses I
  2094. remember off the top of my head are www.info.apple.com and ftp.apple.com.
  2095.  
  2096. --
  2097.  
  2098. Dale Greer, greer@utdallas.edu
  2099. "They know that it is human nature to take up causes whereby a man may
  2100.  oppress his neighbor, no matter how unjustly. ... Hence they have had
  2101.  no trouble in finding men who would preach the damnability and heresy
  2102.  of the new doctrine from the very pulpit..." - Galileo Galilei, 1615
  2103.  
  2104.  
  2105. +++++++++++++++++++++++++++
  2106.  
  2107. >From dubois@primate.wisc.edu (Paul DuBois)
  2108. Date: 15 Jun 1995 09:48:55 -0500
  2109. Organization: Castra Parvulorum
  2110.  
  2111. >From article <3rlshq$1kr@news.utdallas.edu>, by greer@utdallas.edu (Dale M Greer):
  2112. > Here's another vote for TransSkel.  It works well to get started, and 
  2113. > you've got all the source code to teach you how to roll your own, or
  2114. > you can just go in and alter it to suit your own purposes.  The complete
  2115. > package includes TransDisplay and TransEdit, which make it very easy to
  2116. > get text display and editing.  The package also comes with many examples,
  2117. > with projects in three flavors: MPW, THINK, and Metrowerks.
  2118.  
  2119. Which version of TransSkel is this?  Bob's?  The standard version
  2120. (currently at release 3.20) is usable from THINK C (68K), Symantec
  2121. C++ (PPC), Metrowerks C (68K or PPC) and THINK Pascal -- i.e., no
  2122. MPW projects.  Release 3.21 will drop THINK Pascal support in favor
  2123. of Metrowerks Pascal (68K or PPC) support.
  2124.  
  2125. > It is also very small for a framework.  The "Hello" sample is
  2126. about > 20K bytes.  I guess it isn't really a framework, but a
  2127. skeleton.  Anyway, > it's small enough that you can look through
  2128. the code and learn a lot > form it quickly, unlike most frameworks.
  2129.  
  2130. That's good to hear, since that's one of its design goals.
  2131.  
  2132. > Finally, look into Apple's WWW and FTP sites for their code Snippets.
  2133. > They've got a whole mess of examples for all of the older Mac software
  2134. > managers.
  2135.  
  2136. I agree, and will add that in general, an essential part of learning
  2137. Macintosh programming is too look at other people's source code.  Reading
  2138. Inside Macintosh (or other documentation) is fine, but you also need to
  2139. see how people write code in real life.  Source code is particularly helpful
  2140. when you can find some that does something similar to what you want to do.
  2141. -- 
  2142. Paul DuBois
  2143. dubois@primate.wisc.edu
  2144.  
  2145. "I'm going to learn worm-talk next," said Janetta  -- Grandaddy's Place
  2146.  
  2147. +++++++++++++++++++++++++++
  2148.  
  2149. >From clay1@primenet.com (Clayburn Juniel/Effective Software Solutions)
  2150. Date: 15 Jun 1995 20:22:35 GMT
  2151. Organization: Primenet Services for the Internet (602)395-1010
  2152.  
  2153. In article <tasc0001-0506951958380001@dialup-4-60.gw.umn.edu> you wrote:
  2154. : Hello everyone,
  2155.  
  2156. : I've recently begun to try to pick up some Mac programming.  I've got a
  2157. : few of the Inside Mac books, as well as Dave Mark's book, and have gone
  2158. : through the examples.  This toolbox stuff is driving me buggy!  There is
  2159. : so much to understand, I have become overwhelmed to the point that it
  2160. : seems like a mammoth undertaking to even try a *small* mac project.  Even
  2161. : printing an error message takes a major effort.  Required AppleEvents,
  2162. : proper preference files, being background friendly...you see my point.
  2163.  
  2164. I'm a newbie also at programming the Mac.  But I'm a veteran with the 
  2165. IIGS so I am use to using a toolbox.  I suggest you get Inside Mac on CD 
  2166. if you have a CD drive.  Or if you have enough memory on a hard drive you 
  2167. can down load it.  It takes a while to get used to the DOCViewer but 
  2168. its easier after a while.  I also suggest you get an introductory Mac 
  2169. programming book from the book store.
  2170.  
  2171. : So, what advice can you veterans out there give to 
  2172. help me get up to : speed?  A few ideas that I have thought of are:
  2173.  
  2174. : Any pointers will be gratefully gulped down.  I can't be the only one out
  2175. : here that has become frustrated with the daunting task of trying to master
  2176. : the toolbox.
  2177.  
  2178. In a few hours I'm going to upload my first attemp to my FTP site (listed 
  2179. in sig below).  It was written with CodeWarrior.  I'm also uploading the 
  2180. source code.  Let me know if this helps you. And anybody looking at the 
  2181. source all comments are welcome.  Especially "Why did you do that when 
  2182. this would have been better".
  2183.  
  2184. The file name is ASCII.Helper.S.bsc in path /users/c/clay1/applemac
  2185.  
  2186. --
  2187. Clay
  2188.  
  2189. NOTE! Opinions will change due to new information. 
  2190. |--------------------------------------------------------------------|
  2191. |Effective Software Solutions   Clayburn W. Juniel, III              |
  2192. |Custom Software Design         1928 E. Camelback Rd. #623           |
  2193. |Phone:     (602)274-6905       Phoenix, AZ   85016-4143   USA       |
  2194. |Fax:       (602)274-6851                                            |
  2195. |Internet:  clay1@primenet.com  WWW:  http://www.primenet.com/~clay1 |
  2196. |           c.juniel@genie.com  FTP:  ftp.primenet.com  users/c/clay1|
  2197. |--------------------------------------------------------------------|
  2198.  
  2199.  
  2200. +++++++++++++++++++++++++++
  2201.  
  2202. >From wingo@apple.com (Tony Wingo)
  2203. Date: Fri, 16 Jun 1995 00:57:37 GMT
  2204. Organization: Apple Computer
  2205.  
  2206. In article <ellens-0606950857210001@47.128.6.6>, ellens@bnr.ca (Chris
  2207. Ellens) wrote:
  2208.  
  2209. > In article <tasc0001-0506951958380001@dialup-4-60.gw.umn.edu>,
  2210. > tasc0001@gold.tc.umn.edu (Scott Taschler) wrote:
  2211. > ] Hello everyone,
  2212. > ] 
  2213. > ] I've recently begun to try to pick up some Mac programming.  I've got a
  2214. > ] few of the Inside Mac books, as well as Dave Mark's book, and have gone
  2215. > ] through the examples.  This toolbox stuff is driving me buggy!  There is
  2216. > ] so much to understand, I have become overwhelmed to the point that it
  2217. > ] seems like a mammoth undertaking to even try a *small* mac project.  Even
  2218. > ] printing an error message takes a major effort.  Required AppleEvents,
  2219. > ] proper preference files, being background friendly...you see my point.
  2220. > ] 
  2221. > ] So, what advice can you veterans out there give to help me get up to
  2222. > ] speed?  A few ideas that I have thought of are:
  2223. > ] 
  2224. > ] o  Finding a good library out there that provides the basic framework for
  2225. > ] an application, so I can just fill in the unique details of my app  
  2226. > ] 
  2227. > ] o  A good toolkit to isolate some of the complications of the toolbox?
  2228. > ] (ala Tcl/Tk in the UNIX world.)
  2229. > ] 
  2230. > ] o  Perhaps a good class library is what I need.  TC++ has the Visual
  2231. > ] Architect, which looks promising, but the Think Class Library is hardly
  2232. > ] any more simple than the standard toolbox, is it?
  2233. > ] 
  2234. > ] Any pointers will be gratefully gulped down.  I can't be the only one out
  2235. > ] here that has become frustrated with the daunting task of trying to master
  2236. > ] the toolbox.
  2237.  
  2238. I missed the orignal part of this thread, but I would strongly recommend
  2239.  
  2240. "Macintosh Programmiing Secrets, 2nd. Ed" by Scott Knaster and Keith Rollin.
  2241. pub my Addison-Wesley (ISBN 0-201-58134-5)
  2242.  
  2243. They do you a real nice job of walking you through the construction of a
  2244. (C-based) framework one step at a time, discussing why they're doing what
  2245. they're doing at each step. Given the amount of material these guys cover,
  2246. this book is much less daunting than most I've seen. The fact that thye
  2247. both did time in Apple's Developer Technical Support Group doesn't hurt
  2248. either.
  2249.  
  2250. -- 
  2251. -tony
  2252.  
  2253. >>usual disclaimer<<
  2254.  
  2255. +++++++++++++++++++++++++++
  2256.  
  2257. >From greer@utdallas.edu (Dale M Greer)
  2258. Date: 16 Jun 1995 04:52:58 GMT
  2259. Organization: The University of Texas at Dallas
  2260.  
  2261. Paul DuBois (dubois@primate.wisc.edu) wrote:
  2262. > From article <3rlshq$1kr@news.utdallas.edu>, by greer@utdallas.edu (Dale M Greer):
  2263. > > [...TransSkel has...]
  2264. > > projects in three flavors: MPW, THINK, and Metrowerks.
  2265.  
  2266. > Which version of TransSkel is this?  Bob's?  The standard version
  2267. > (currently at release 3.20) is usable from THINK C (68K), Symantec
  2268. > C++ (PPC), Metrowerks C (68K or PPC) and THINK Pascal -- i.e., no
  2269. > MPW projects.  Release 3.21 will drop THINK Pascal support in favor
  2270. > of Metrowerks Pascal (68K or PPC) support.
  2271.  
  2272. Doh!  Guess I should have checked before I said it had an MPW project.
  2273.  
  2274. --
  2275.  
  2276. Dale Greer, greer@utdallas.edu
  2277. "I'm tryin' ta think, but nutt'n happens!" - Curley
  2278.  
  2279.  
  2280. +++++++++++++++++++++++++++
  2281.  
  2282. >From bhillier@bnr.ca (Bob Hillier)
  2283. Date: 16 Jun 1995 17:33:35 GMT
  2284. Organization: Bell-Northern Research Ltd.
  2285.  
  2286.  
  2287. In article <wingo-1506951757370001@wingosmac.apple.com>, wingo@apple.com (Tony Wingo) writes:
  2288. |> I missed the orignal part of this thread, but I would strongly recommend
  2289. |> 
  2290. |> "Macintosh Programmiing Secrets, 2nd. Ed" by Scott Knaster and Keith Rollin.
  2291. |> pub my Addison-Wesley (ISBN 0-201-58134-5)
  2292. |> 
  2293.  
  2294. This book is quite good except that some of the example code is
  2295. *NOT* included in the book. A terse description of the kind of 
  2296. changes required for a particular section is provided and I have
  2297. not quite figured out what the description really means. I am an
  2298. experienced UNIX C/C++ programmer but new to the MAC
  2299. environment.
  2300.  
  2301. Anyways... I know that the source code is available on a disk
  2302. from the publisher but that means I wait 3-4 weeks if I order
  2303. it. Does anyone have a softcopy or know where I can get a
  2304. softcopy of the source? (I am not trying to avoid paying the
  2305. publisher, I just want to continue working through the example).
  2306. As well, typing the source in is pretty much a drag and I
  2307. *really* want a softcopy if I can find it.
  2308.  
  2309. thanks
  2310. bob
  2311.  
  2312.  
  2313.  
  2314. ---------------------------
  2315.  
  2316. >From am4001@kestrel.fen.bris.ac.uk (Alex Metcalf)
  2317. Subject: Time manager callback without asm?
  2318. Date: Sun, 11 Jun 1995 00:02:20 GMT
  2319. Organization: The Twilight Zone
  2320.  
  2321.  
  2322. Hey everyone,
  2323.  
  2324.         I've been doing a bit of code tidying up in preparation for
  2325. recompiling for Power Macs. So... some of my code involves a time callback
  2326. whereby the TMTaskPtr (or whatever it is) is passed to the callback in
  2327. register A1.
  2328.  
  2329.         Having scanned through the Universal Headers, it appears that I
  2330. need some form of glue, and perhaps the use of a UPP. However, even though
  2331. I got the Universal Headers with SC++ 7, I received zero information in
  2332. the documentation about how to use them. Exactly how do I set up a Time
  2333. Manager callback to read A1 _without_ using asm, and probably using some
  2334. new glue stuff? It would always help if I knew exactly what a UPP is, but
  2335. as I said, I haven't got any docs on it.
  2336.  
  2337.         Thanx,
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.         Alex
  2344.  
  2345. --
  2346. Alex Metcalf             Windows 95: Just another
  2347. am4001@bristol.ac.uk        pane in the glass.
  2348.  
  2349. http://www.fen.bris.ac.uk/students/am4001/
  2350.  
  2351.  
  2352. +++++++++++++++++++++++++++
  2353.  
  2354. >From jumplong@aol.com (Jump Long)
  2355. Date: 11 Jun 1995 03:23:43 -0400
  2356. Organization: America Online, Inc. (1-800-827-6364)
  2357.  
  2358. Alex Metcalf writes:
  2359. >I've been doing a bit of code tidying up in preparation for recompiling
  2360. >for Power Macs. So... some of my code involves a time callback whereby
  2361. >the TMTaskPtr (or whatever it is) is passed to the callback in register
  2362. >A1.
  2363. >
  2364. > Having scanned through the Universal Headers, it appears that I need
  2365. >some form of glue, and perhaps the use of a UPP. However, even though I
  2366. >got the Universal Headers with SC++ 7, I received zero information in
  2367. >the documentation about how to use them. Exactly how do I set up a Time
  2368. >Manager callback to read A1 _without_ using asm, and probably using some
  2369. >new glue stuff? It would always help if I knew exactly what a UPP is,
  2370. >but as I said, I haven't got any docs on it.
  2371.  
  2372. Alex, for a simple example of a Time Manager task that compiles for both
  2373. CFM and non-CFM (classic 68K), see the function TimeOutTask in the file
  2374. Search.c in Apple's MoreFiles sample code. The code shows how to
  2375. conditionally build your code to work either way using #if GENERATINGCFM
  2376. and how to use the NewTimerProc macro to get a UPP to pass in tmAddr. 
  2377.  
  2378. - Jim Luther
  2379.  
  2380. ---------------------------
  2381.  
  2382. >From dubois@uakari.primate.wisc.edu (Paul DuBois)
  2383. Subject: TransSkel 3.21 is available (MW Pascal support added)
  2384. Date: 16 Jun 1995 14:18:18 -0500
  2385. Organization: Castra Parvulorum
  2386.  
  2387. Release 3.21 of TransSkel, a skeleton for Macintosh application development
  2388. under MetroWerks C or Pascal or Symantec C++/THINK C, is now available.
  2389.  
  2390. This is an update release; it provides support for Metrowerks Pascal (68K or
  2391. PPC) and NO LONGER provides support for THINK Pascal.  The 3.21 release
  2392. notes provide details on the reasons for this decision.  I have only tried
  2393. using TransSkel with MW Pascal from CodeWarrior 6/6.1, although I'd expect
  2394. it to work with earlier CW releases.
  2395.  
  2396. As before, TransSkel still compiles under MetroWerks C (PPC or 68K), as well
  2397. as Symantec C++ (PPC) and THINK C (68K).
  2398.  
  2399. TransDisplay 3.10 and TransEdit 3.10 are also available now, and have been
  2400. updated in similarly.  TransDisplay and TransEdit are modules that can be
  2401. dropped into TransSkel-based projects to provide display-only or editable
  2402. text windows.
  2403.  
  2404. TransSkel, TransDisplay, and TransEdit are available via any of the following:
  2405.  
  2406. anonymous ftp to ftp.primate.wisc.edu (under /pub/mac/TransSkel)
  2407.  
  2408. gopher to gopher.primate.wisc.edu, then select "Primate Center Software
  2409. Archives")
  2410.  
  2411. WWW using URL http://www.primate.wisc.edu/software/mac/TransSkel/.
  2412.  
  2413. TransSkel 3.20, TransDisplay 3.09, and TransEdit 3.09 are the last release
  2414. to retain THINK Pascal support.  They will remain on the archive site
  2415. indefinitely.
  2416. -- 
  2417. Paul DuBois
  2418. dubois@primate.wisc.edu
  2419.  
  2420. "I'm going to learn worm-talk next," said Janetta  -- Grandaddy's Place
  2421.  
  2422. ---------------------------
  2423.  
  2424. >From rgaros@paramount.nikhefk.nikhef.nl (Rene Ros)
  2425. Subject: Uppercase Command Keys?
  2426. Date: Thu, 15 Jun 1995 19:49:35 GMT
  2427. Organization: NIKHEFK
  2428.  
  2429. Hi,
  2430.  
  2431. I've been struggling with the code listed in IM Text on page C-24 to
  2432. have uppercase Command key equivalents. I.e. I need to be able to get
  2433. the character code for a question mark, which means most of the time the
  2434. shift key shouldn't be ignored.
  2435.  
  2436. Is there a mistake in the sample code in IM Text? Or am I doing something
  2437. wrong? Does someone have some C code which does the same? Perhaps I've
  2438. been juggling with the bit operators? :-)
  2439.  
  2440. Thanks in advance,
  2441. Rene
  2442.  
  2443. PS. Please post and remail your reply. The newshost at my usual site
  2444.     (bio.vu.nl) is acting up weird. You can email to the address listed
  2445.     in the header or to rgaros@bio.vu.nl. Thanks!
  2446.  
  2447.  
  2448. +++++++++++++++++++++++++++
  2449.  
  2450. >From ari@shore.net (Ari Halberstadt)
  2451. Date: Sat, 17 Jun 1995 04:01:01 -0400
  2452. Organization: North Shore Access/Eco Software, Inc; (info@shore.net)
  2453.  
  2454. In article <1995Jun15.194935.29479@paramount.nikhefk.nikhef.nl>,
  2455. rgaros@paramount.nikhefk.nikhef.nl (Rene Ros) wrote:
  2456.  
  2457. >Hi,
  2458. >
  2459. >I've been struggling with the code listed in IM Text on page C-24 to
  2460. >have uppercase Command key equivalents. I.e. I need to be able to get
  2461. >the character code for a question mark, which means most of the time the
  2462. >shift key shouldn't be ignored.
  2463. >
  2464. >Is there a mistake in the sample code in IM Text? Or am I doing something
  2465. >wrong? Does someone have some C code which does the same? Perhaps I've
  2466. >been juggling with the bit operators? :-)
  2467.  
  2468.       ...
  2469.       key = (macevent->message & keyCodeMask) >> CHAR_BIT;
  2470.       key = (wsKeyUsingModifiers(key, 0) & charCodeMask);
  2471.       menu = MenuKey(key);
  2472.       ...
  2473.  
  2474. /* wsKeyUsingModifiers returns the key code (virtual and ascii codes)
  2475.    that would be generated from typing the given key code and modifiers.
  2476.    You can get the key code from the event message for a keyDown event
  2477.    by using keyCodeMask and shifting the result right by CHAR_BIT. This
  2478.    function is useful for detecting command-key combinations using
  2479.    additional modifiers. */
  2480. long wsKeyUsingModifiers(unsigned char code, unsigned short modifiers)
  2481. {
  2482.    UInt32   state = 0;  /* state for KeyTranslate */
  2483.    Ptr      kchr;       /* current 'KCHR' */
  2484.  
  2485.    kchr = (Ptr) GetScriptManagerVariable(smKCHRCache);
  2486.    return(KeyTranslate(kchr, ((modifiers & 0xff00) | code), &state));
  2487. }
  2488.  
  2489. -- 
  2490. Ari Halberstadt  ari@shore.net  (formerly ari@world.std.com)
  2491. And yet, there was only one great thing. / To live. / To See. / In hunts and on journeys / the great day that dawns / and the light that fills the world. -- Inuit, from "500 Nations".
  2492.  
  2493. ---------------------------
  2494.  
  2495. >From lkw@aol.com (Lkw)
  2496. Subject: [Q] Drag and Drop Mgr hilighting
  2497. Date: 2 Jun 1995 00:25:35 -0400
  2498. Organization: America Online, Inc. (1-800-827-6364)
  2499.  
  2500. Anybody know what RGBColors (foregound and background), PenPat, and
  2501. PenMode Apple uses to highlight in the Drag and Drop Manager?  I need to
  2502. directly update and manipulate areas that the Drag Manager highlights, and
  2503. therefore need to use the same colors and modes so that when the Drag Mgr
  2504. decides to un-highlight, the border will return to normal.
  2505.  
  2506. +++++++++++++++++++++++++++
  2507.  
  2508. >From blm@chinook.halcyon.com (Brian L. Matthews)
  2509. Date: 3 Jun 1995 06:51:40 GMT
  2510. Organization: Northwest Nexus, Inc. - Professional Internet Services
  2511.  
  2512. In article <3qm3rv$jro@newsbf02.news.aol.com>, Lkw <lkw@aol.com> wrote:
  2513. |Anybody know what RGBColors (foregound and background), PenPat, and
  2514. |PenMode Apple uses to highlight in the Drag and Drop Manager?
  2515.  
  2516. It uses HiliteMode, which is described pretty well in Inside Mac.
  2517.  
  2518. |update and manipulate areas that the Drag Manager highlights, and
  2519. |therefore need to use the same colors and modes so that when the Drag Mgr
  2520. |decides to un-highlight, the border will return to normal.
  2521.  
  2522. I suggest looking at UpdateDragHilite.  It's designed for just this case.
  2523.  
  2524. Brian
  2525.  
  2526. +++++++++++++++++++++++++++
  2527.  
  2528. >From skevill@tartarus.uwa.edu.au (Scott Kevill)
  2529. Date: Sun, 04 Jun 1995 23:04:36 -0700
  2530. Organization: The University of Western Australia
  2531.  
  2532. In article <3qp0ps$pi0@news1.halcyon.com>, blm@chinook.halcyon.com (Brian
  2533. L. Matthews) wrote:
  2534.  
  2535. > In article <3qm3rv$jro@newsbf02.news.aol.com>, Lkw <lkw@aol.com> wrote:
  2536. > |Anybody know what RGBColors (foregound and background), PenPat, and
  2537. > |PenMode Apple uses to highlight in the Drag and Drop Manager?
  2538. > It uses HiliteMode, which is described pretty well in Inside Mac.
  2539. > |update and manipulate areas that the Drag Manager highlights, and
  2540. > |therefore need to use the same colors and modes so that when the Drag Mgr
  2541. > |decides to un-highlight, the border will return to normal.
  2542. > I suggest looking at UpdateDragHilite.  It's designed for just this case.
  2543. > Brian
  2544.  
  2545. This is incorrect, the Drag Manager does not use HiliteMode, it uses the
  2546. tinge colours for windows set in the Color control panel. Try it and see.
  2547.  
  2548. There is a DTS snippet (toolbox/GetDragHiliteColor or something) that
  2549. calculates the correct colour to draw with. However it doesn't handle the
  2550. situation for b&w, which is simply a 50% gray pattern. This is not
  2551. guaranteed to stay the same in the future, because it is undocumented.
  2552.  
  2553. Hope this helps,
  2554.  
  2555. Scott Kevill
  2556. skevill@tartarus.uwa.edu.au
  2557.  
  2558. +++++++++++++++++++++++++++
  2559.  
  2560. >From ldo@waikato.ac.nz (Lawrence D9Oliveiro)
  2561. Date: Wed, 07 Jun 1995 17:33:03 +1200
  2562. Organization: University of Waikato
  2563.  
  2564. In article <skevill-0406952304360001@s187.dialup.uwa.edu.au>,
  2565. skevill@tartarus.uwa.edu.au (Scott Kevill) wrote:
  2566.  
  2567. >In article <3qp0ps$pi0@news1.halcyon.com>, blm@chinook.halcyon.com (Brian
  2568. >L. Matthews) wrote:
  2569. >
  2570. >> In article <3qm3rv$jro@newsbf02.news.aol.com>, Lkw <lkw@aol.com> wrote:
  2571. >> |Anybody know what RGBColors (foregound and background), PenPat, and
  2572. >> |PenMode Apple uses to highlight in the Drag and Drop Manager?
  2573. >> 
  2574. >> It uses HiliteMode, which is described pretty well in Inside Mac.
  2575. >> 
  2576. >> |update and manipulate areas that the Drag Manager highlights, and
  2577. >> |therefore need to use the same colors and modes so that when the Drag Mgr
  2578. >> |decides to un-highlight, the border will return to normal.
  2579. >> 
  2580. >> I suggest looking at UpdateDragHilite.  It's designed for just this case.
  2581. >> 
  2582. >> Brian
  2583. >
  2584. >This is incorrect, the Drag Manager does not use HiliteMode, it uses the
  2585. >tinge colours for windows set in the Color control panel. Try it and see.
  2586.  
  2587. Yes, but I think it's using that colour with HiliteMode. How do I know? I
  2588. had some code that, after calling ShowDragHilite and accepting the drag,
  2589. was causing the window to be erased in its drag receive handler. Naturally
  2590. this wiped the drag highlight; then when I called HideDragHilite in the
  2591. track-drag handler to turn off the highlight before cleaning up, the
  2592. highlight appeared again!
  2593.  
  2594. +++++++++++++++++++++++++++
  2595.  
  2596. >From blm@chinook.halcyon.com (Brian L. Matthews)
  2597. Date: 7 Jun 1995 18:10:37 GMT
  2598. Organization: Northwest Nexus, Inc. - Professional Internet Services
  2599.  
  2600. In article <skevill-0406952304360001@s187.dialup.uwa.edu.au>,
  2601. Scott Kevill <skevill@tartarus.uwa.edu.au> wrote:
  2602. |In article <3qp0ps$pi0@news1.halcyon.com>, blm@chinook.halcyon.com (Brian
  2603. |L. Matthews) wrote:
  2604. |> It uses HiliteMode, which is described pretty well in Inside Mac.
  2605. |This is incorrect, the Drag Manager does not use HiliteMode, it uses the
  2606. |tinge colours for windows set in the Color control panel. Try it and see.
  2607.  
  2608. Right you are.  Apple's documentation is somewhat misleading here.  Near
  2609. the bottom of page 13 in the Drag and Drop Human Interface Guidelines,
  2610. it says "In the case of color, the frame is drawn in Color Quickdraw's
  2611. hilite mode."  However, the previous sentence (which I managed to forget
  2612. when I posted my first followup :-)) reads "The Drag Manager draws the
  2613. frame in a color based on the window color specified in the Colors control
  2614. panel."  So it does use hilite mode, it just uses the window color instead
  2615. of the hilite color.
  2616.  
  2617. |There is a DTS snippet (toolbox/GetDragHiliteColor or something) that
  2618. |calculates the correct colour to draw with. However it doesn't handle the
  2619. |situation for b&w, which is simply a 50% gray pattern. This is not
  2620. |guaranteed to stay the same in the future, because it is undocumented.
  2621.  
  2622. Do you mean the 50% gray pattern isn't documented, or the DTS snippet?
  2623. The 50% gray pattern is documented, again on page 13.
  2624.  
  2625. Brian
  2626.  
  2627. +++++++++++++++++++++++++++
  2628.  
  2629. >From Simon Fraser <s.fraser@ic.ac.uk>
  2630. Date: 8 Jun 1995 20:34:41 GMT
  2631. Organization: NERC Centre for Population Biology, Imperial College
  2632.  
  2633. --blm@chinook.halcyon.com (Brian L. Matthews) wrote:
  2634. >In article <skevill-0406952304360001@s187.dialup.uwa.edu.au>,
  2635. >Scott Kevill <skevill@tartarus.uwa.edu.au> wrote:
  2636. >|In article <3qp0ps$pi0@news1.halcyon.com>, blm@chinook.halcyon.com (Brian
  2637. >|L. Matthews) wrote:
  2638. >|> It uses HiliteMode, which is described pretty well in Inside Mac.
  2639. >|This is incorrect, the Drag Manager does not use HiliteMode, it uses the
  2640. >|tinge colours for windows set in the Color control panel. Try it and see.
  2641. >
  2642. >Right you are.  Apple's documentation is somewhat misleading here.  Near
  2643. >the bottom of page 13 in the Drag and Drop Human Interface Guidelines,
  2644. >it says "In the case of color, the frame is drawn in Color Quickdraw's
  2645. >hilite mode."  However, the previous sentence (which I managed to forget
  2646. >when I posted my first followup :-)) reads "The Drag Manager draws the
  2647. >frame in a color based on the window color specified in the Colors control
  2648. >panel."  So it does use hilite mode, it just uses the window color instead
  2649. >of the hilite color.
  2650. >
  2651. >|There is a DTS snippet (toolbox/GetDragHiliteColor or something) that
  2652. >|calculates the correct colour to draw with. However it doesn't handle the
  2653. >|situation for b&w, which is simply a 50% gray pattern. This is not
  2654. >|guaranteed to stay the same in the future, because it is undocumented.
  2655. >
  2656. >Do you mean the 50% gray pattern isn't documented, or the DTS snippet?
  2657. >The 50% gray pattern is documented, again on page 13.
  2658.  
  2659. Have you folks seen the technote?
  2660.  
  2661.    http://www.info.apple.com/dev/technotes/Toolbox/tb_33.html
  2662.  
  2663. This has some stuff about custom window colours and the drag hilite
  2664. colour, which might solve the problems.
  2665.  
  2666. _________________________________________________________________
  2667. Simon Fraser                   NERC Centre for Population Biology
  2668. s.fraser@ic.ac.uk                Imperial College at Silwood Park
  2669.                                        Ascot, Berks.  SL5 7PY  UK
  2670.  
  2671.  
  2672. +++++++++++++++++++++++++++
  2673.  
  2674. >From skevill@tartarus.uwa.edu.au (Scott Kevill)
  2675. Date: Sat, 10 Jun 1995 13:45:02 +0800
  2676. Organization: The University of Western Australia
  2677.  
  2678. In article <3r4q2t$9es@news1.halcyon.com>, blm@chinook.halcyon.com (Brian
  2679. L. Matthews) wrote:
  2680.  
  2681. > In article <skevill-0406952304360001@s187.dialup.uwa.edu.au>,
  2682. > Scott Kevill <skevill@tartarus.uwa.edu.au> wrote:
  2683. >
  2684. > |There is a DTS snippet (toolbox/GetDragHiliteColor or something) that
  2685. > |calculates the correct colour to draw with. However it doesn't handle the
  2686. > |situation for b&w, which is simply a 50% gray pattern. This is not
  2687. > |guaranteed to stay the same in the future, because it is undocumented.
  2688. > Do you mean the 50% gray pattern isn't documented, or the DTS snippet?
  2689. > The 50% gray pattern is documented, again on page 13.
  2690. > Brian
  2691.  
  2692. Sorry for the confusion.
  2693.  
  2694. I meant the method for obtaining the colour is not documented, and this
  2695. warning is also given in the snippet. I also meant that the snippet works
  2696. properly only in colour, it does not draw the 50% gray in b&w when perhaps
  2697. it should.
  2698.  
  2699. Hope this clears things up.
  2700.  
  2701. Scott.
  2702.  
  2703. --
  2704.  
  2705. Scott Kevill
  2706. skevill@tartarus.uwa.edu.au
  2707.  
  2708. ---------------------------
  2709.  
  2710. >From oster@netcom.com (David Phillip Oster)
  2711. Subject: [Q] How to tell if a hard disk is removable
  2712. Date: Thu, 8 Jun 1995 01:00:28 GMT
  2713. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  2714.  
  2715.  
  2716. The Memory control panel gives you a pop-up menu of hard disks for setting
  2717. the location of a virtual memory swap file. It does not include removable
  2718. hard disks. How does it know?
  2719.  
  2720. More generally, how do you tell if a hard disk is removable?
  2721. -- 
  2722. - ------- <mail-to:oster@netcom.com> ----------
  2723. Ahh! The thorazine is wearing off and the odinazine is coming on...
  2724.  
  2725. +++++++++++++++++++++++++++
  2726.  
  2727. >From Alex Rosen <alex@procd.com>
  2728. Date: 8 Jun 1995 13:34:47 GMT
  2729. Organization: Pro CD, Inc.
  2730.  
  2731. In article <osterD9txGs.I8@netcom.com> David Phillip Oster,
  2732. oster@netcom.com writes:
  2733. >More generally, how do you tell if a hard disk is removable?
  2734.  
  2735. This is some code that I copied from John Norstad's Disinfectant source.
  2736. It's probably in MoreFiles, too (everything else is).
  2737. --Alex
  2738.  
  2739. /* Returns true if the volume is ejectable. */
  2740. Boolean IsEjectable (short vRefNum)
  2741. {
  2742.         HParamBlockRec  pBlock;                         /* vol info param block */
  2743.         short                   driveNum;                       /* driver number of cur vol */
  2744.         DrvQEl                  *curDrive;                      /* ptr to current drive queue element */
  2745.         OSErr                   rCode;                          /* result code */
  2746.         unsigned char   flagByte;                       /* drive queue element flag byte */
  2747.         
  2748.         /* Get driveNum = drive number of drive containing volume. */
  2749.         
  2750.         pBlock.volumeParam.ioNamePtr = nil;
  2751.         pBlock.volumeParam.ioVolIndex = 0;
  2752.         pBlock.volumeParam.ioVRefNum = vRefNum;;
  2753.         if (( rCode = PBHGetVInfo(&pBlock, false) ) != noErr) return false;
  2754.         driveNum = pBlock.volumeParam.ioVDrvInfo;
  2755.         
  2756.         /*      Walk the drive queue until we find driveNum.  The second byte in
  2757.                 the four flag bytes preceding the drive queue element is 8 or $48 
  2758.                 if the drive is nonejectable. */
  2759.         
  2760.         curDrive = (DrvQEl*)(GetDrvQHdr())->qHead;
  2761.         while (true) {
  2762.                 if (curDrive->dQDrive == driveNum) {
  2763.                         flagByte = *((Ptr)curDrive - 3);
  2764.                         return (flagByte != 8 && flagByte != 0x48);
  2765.                 };
  2766.                 curDrive = (DrvQEl*)curDrive->qLink;
  2767.                 if (!curDrive) return false;
  2768.         };
  2769. }
  2770.  
  2771. +++++++++++++++++++++++++++
  2772.  
  2773. >From sped@lfso.ifa.hawaii.edu (Byron Han)
  2774. Date: Thu, 8 Jun 1995 20:26:59 GMT
  2775. Organization: Institute for Astronomy, Hawaii
  2776.  
  2777. In article <osterD9txGs.I8@netcom.com> oster@netcom.com (David Phillip Oster) writes:
  2778. >
  2779. >The Memory control panel gives you a pop-up menu of hard disks for setting
  2780. >the location of a virtual memory swap file. It does not include removable
  2781. >hard disks. How does it know?
  2782. >
  2783. >More generally, how do you tell if a hard disk is removable?
  2784.  
  2785. There is a bit in the drive queue that tells you if a drive is ejectable
  2786. or not.
  2787.  
  2788. --
  2789.  Byron Han, Graduate Student        University of Hawai`i at Mano`a
  2790.  Institute for Astronomy                 Email: sped@ifa.hawaii.edu
  2791.  Quote: "Given current global population growth rates, reproduction 
  2792.                   will soon no longer be a right but a priviledge."
  2793.  
  2794. ---------------------------
  2795.  
  2796. End of C.S.M.P. Digest
  2797. **********************
  2798.